MATLAB: Find index of last 5 largest values in cell array

find index of last 5 largest values in cell array

I have a cell array of numbers a = {5 ; 6 ; 8 ; 8 ; 10; 1 ; 15 ; 25 ; 10 ; 35 ; 45 ; 3}
I need to find the index of last five largest values in cell array
index = 11,10,8,7,5
How can i do this ?
Thanks a lot

Best Answer

This works:
[as,idx] = sort(cell2mat(a),'descend');
result = idx(1:5);