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

Illustration
Travis - 2021-03-02T10:14:08+00:00
Question: How to know the location of maximum value in a vector?

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?

Expert Answer

Profile picture of Kshitij Singh Kshitij Singh answered . 2025-11-20

doc max

[value,index] = max(A);


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!