help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

how to vectorize it


From: shivax
Subject: how to vectorize it
Date: Sun, 21 Jul 2019 13:40:55 -0500 (CDT)

hi, see this code:

 input for example:

 ris=[1 0 0;0 1 0;1 0 0; 0 1 1]
 tit=[0 1 0 0]

 tic
 bb=0;
 for hh=1:columns(ris)
  bb=0;
  for gg=1:rows(ris)
    if tit(gg) 
         bb=0;
        if ris(gg,hh)
            bb=1;    
     endif
    endif 
     ris(gg,hh)=bb;   
   endfor
 endfor
 toc
 
 

it's possible to avoid loop?



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]