From: Luka Djigas on 18 Nov 2009 21:56 Apart from the "usual" loop method, does matlab know a better way of finding the position of a maximum value in x(1:100) array ? Say I have, an array with 100 values inside. The maximum is at the position 53. How to get that position in a variable ? All ideas appreciated ... With best regards, Luka
From: Steven Lord on 18 Nov 2009 22:09 "Luka Djigas" <ldigas@___gmail___.com> wrote in message news:csc9g5paf87a3g0bepth3sb6c7i2v5rhkh(a)4ax.com... > Apart from the "usual" loop method, does matlab know a better way of > finding the position of a maximum value in x(1:100) array ? > > Say I have, an array with 100 values inside. The maximum is at the > position 53. How to get that position in a variable ? Use the second output of the MAX function. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
From: Matt Fig on 18 Nov 2009 23:12 "Steven Lord" <slord(a)mathworks.com> wrote in message > Use the second output of the MAX function. That's what I think of as the "usual" method! To the OP, if there could be more than one location for the same maximum value and you want to know all locations, you may want to look at the FIND function.
|
Pages: 1 Prev: Error when running executable compiled using Matlab within C++ program Next: newrb |