help-octave
[Top][All Lists]
Advanced

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

Re: Reading mat file


From: Mech.Mon
Subject: Re: Reading mat file
Date: Wed, 21 Mar 2012 22:25:27 -0700 (PDT)

I often have to find specific values in a data set. Here's what I use (from
note file).

Finding values in a matrix in Octave.

#[Row,Column]=find(value_looking_for==variable);
#value_found=variable(Row,Column);

#for example:

x=[0:0.01:6*pi];
y=sin(x);
idx=find(0.5==y);
y(idx);# value not found "[]=(1x0)" you might have to look around the target
value
idx=find(0.5<y & y<0.52);
#recall "|"=and, "&"=or, "!"=not
y(idx)
#to find the x values that result in those values just look at:
x(idx)
#also can be put into variables
value_looking_for=0.5;
tolerance=0.01;
idx=find(value_looking_for-tolerance<=y & y<=value_looking_for+tolerance);

hold on
plot(x,y)
plot(x(idx),y(idx),"o")


-----
******
And AC said, "LET THERE BE LIGHT!"
--
View this message in context: 
http://octave.1599824.n4.nabble.com/Re-Reading-mat-file-tp4487833p4494640.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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