To the the maximum value of an array and the index of the maximum value, use the max() function as below:
>> a = [1 4 5 7 3 2]
a =
1 4 5 7 3 2
>> [max, index] = max(a)
max =
7
index =
4
>>
Reference:
max - Maximum elements of an array (MathWorks)
沒有留言:
張貼留言