[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Vectorize an extraction
From: |
John W. Eaton |
Subject: |
Vectorize an extraction |
Date: |
Thu, 2 Dec 2010 13:16:24 -0500 |
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