MATLAB: How to know the location of maximum value in a vector

MATLABSignal Processing Toolboxx axis of a 1d vector

Dear All,
I have a vector such as A = [1 2 2 3 2 4 5 7 6 6 5 4]. As we can see that 7 is the maximum value of this vector. I want to know the location of this maximum value, in this example it is the 8th element. How find that?

Best Answer

doc max
[value,index] = max(A);