help-octave
[Top][All Lists]
Advanced

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

Re: Vectorize an extraction


From: Keith Grider
Subject: Re: Vectorize an extraction
Date: Thu, 2 Dec 2010 13:29:08 -0600

You guys rock!

That was it. I will put that in my quiver for future use. That sped up the code orders of magnitude.

Keith

On Thu, Dec 2, 2010 at 12:16 PM, John W. Eaton <address@hidden> wrote:
On  2-Dec-2010, keithspg wrote:

|
| I did not know how best to title this, but I am working on analysis of a data
| set. In that set, there are values I do not want to consider nor plot as
| they are zero. Currently, I am using this loop to extract the values I want
| (all voltages >0.5)
|                 j=1;
|               for i = 1:(size(data,1)-1); # extracting only loaded values loop
|               if(data(i,2) > 0.5);
|               loaded(j,1)=data(i,1);
|               loaded(j,2)=data(i,2);
|               j=j+1;
|               endif
|               endfor
|
| I was hoping to make this faster in execution by vectorizing this and am
| looking for advice on how best to do it.

Maybe something like this?

 idx = find (data(1:(end-1),2) > 0.5);
 loaded1 = data(idx,1:2);

jwe


reply via email to

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