How to get index number of an element in an array
How to get index number of an element in an array
(OP)
Hi,
I'm calculating a frequency response of a variable. So basicly I have an array of frequency, and I have a corresponding array of the variable. My question is how can I get the index number of the maximum value of the variable?
Is there a simple command?
Thanks for your help.
bj
I'm calculating a frequency response of a variable. So basicly I have an array of frequency, and I have a corresponding array of the variable. My question is how can I get the index number of the maximum value of the variable?
Is there a simple command?
Thanks for your help.
bj





RE: How to get index number of an element in an array
xnuke
"Live and act within the limit of your knowledge and keep expanding it to the limit of your life." Ayn Rand, Atlas Shrugged.
Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
RE: How to get index number of an element in an array
Check out the form that returns two values.
RE: How to get index number of an element in an array
So my question is how to get index number of median element (if it exists) in vector/array. (without using for loop)
[val,index]=median(x)
displays error: to many output arguments
It seems that this works only with max/min
RE: How to get index number of an element in an array
I guess the median(x) funcion calculates the median value of your array. For example, if x=0 1 2 3 4 5,
then median(x)=2.5, and 2.5 is not an element in the array.