How to know the location of maximum value in a vector?

1 Ansicht (letzte 30 Tage)
Meshooo
Meshooo am 6 Nov. 2013
Kommentiert: Meshooo am 6 Nov. 2013
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?

Akzeptierte Antwort

Andrei Bobrov
Andrei Bobrov am 6 Nov. 2013
doc max
[value,index] = max(A);

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by