help-octave
[Top][All Lists]
Advanced

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

Re: How do I replace this "for" loop?


From: Jonathan Stickel
Subject: Re: How do I replace this "for" loop?
Date: Tue, 31 May 2005 14:26:04 -0700
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050317)

How about:

angleofdata = angle(data);
idx = find( angleofdata>3 );
angleofdata(idx) = angleofdata(idx)-2*pi;
idx = find( angleofdata<-3 );
angleofdata(idx) = angleofdata(idx)+2*pi;
clear idx

Jonathan


Robert A. Macy wrote:
How do I replace these "for" loops?

for i=1:rowsdata
  for k=1:columnsdata
    angleofdata(i,k)=angle(data(i,k));
      if (angleofdata(i,k)>3)
        angleofdata(i,k)=angleofdata(i,k)-2*pi();
      endif
      if (angleofdata(i,k)<-3)
        angleofdata(i,k)=angleofdata(i,k)+28pi();
      endif
  endfor
endfor

Big matrix takes a looooong time.
        - Robert -



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------





-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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