MATLAB: How to find index of maximum value/s of a matrix

findmatrixmaximum valuesort

I have a 256-by-1 matrix, let's name it 'Matrix1'. I used sort to arrange the elements in descending order.
maxes = sort(Matrix1, 'descend');
How can I get the corresponding indices (from Matrix1) of that first five maximum values outputted by maxes?
EDIT: I also accept the sort method. I've already tried that. However, is there a chance this can be solved using both sort and find function too?

Best Answer

a=[2 3 1 5 6 4 0 5 2]
[out,indices]=sort(a,'descend')