MATLAB: To get the column number of max and min number

arraymax

I have an array,
a=[ 1 5 3 7 4]
How can I get the position of max and min numbere?
The answer should be
max = 4 %(number 7 which is at column 4 )
min = 1 %(number 1 which is at column 1 )

Best Answer

>> a = [1,5,3,7,4]
a =
1 5 3 7 4
>> [~,mxi] = max(a)
mxi = 4
>> [~,mni] = min(a)
mni = 1