help-octave
[Top][All Lists]
Advanced

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

Re: Reading mat file


From: Luke M
Subject: Re: Reading mat file
Date: Sat, 31 Mar 2012 17:41:36 -0700 (PDT)

asha g wrote
> 
> 
> 
>> Oops, I missed this.  If all you want are the indices of vector that
>> equal
>> the maximum value, that's a whole lot easier than finding local maxima.
>> 
>> idx = find(vv1 == max(vv1))
>> 
> But it will only give one max value instead of all the peak values - I
> need all peak values and their corresponding x values.
> 

No, [m,i] = max(vv1) will give you the first index of the maximum value. 
find(vv1 == max(vv1)) will give you all indices with numbers equal to the
maximum value.

octave:2> a = [1 2 3 3 2 3 2 1]
a =
   1   2   3   3   2   3   2   1
octave:3> [m,i] = max(a)
m =  3
i =  3
octave:4> find(a==max(a))
ans =
   3   4   6

--
View this message in context: 
http://octave.1599824.n4.nabble.com/Re-Reading-mat-file-tp4487833p4522516.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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