MATLAB: Matlab Minimum

arraylastminimum

Hello,
If I have an array for example: A=[10 11 12 1 8 9 1 3 5] and I use the '[C,I]=min' function to find the minimum value of the array. But if the array has two or more same minimum values, the MIN function always return the first value!How can I get the last minimum value of an array?In my example, I want the 7th value 1 of array A and not the 4th.However, I want this function to work for random arrays and not only for array A.
Thank you..!!

Best Answer

find(A==min(A))
will get them all. Then you can choose whichever you like. To get just the last one
find(A==min(A),1,'last')