How to get the largest element index in matlab array

matlab, max, octave

Solution

Use the second output argument of the `max` function:

[ max_value, max_index ] = max( [ 3 9 1 ] )

Problem

Here is a simple double array: ``` array=[3 1 1] ``` Largest element index is 1 or: ``` array=[3 9 1] ``` Largest element index is 2 How can I get the largest element index?

Original source