MATLAB: Extract 5 highest value of a vector

extractindices

If I want to extract the indices of the 5 highest value of a avg vector (30×1 for example) how can I do?
ind = find(avgDE… )

Best Answer

[a,ii] = sort(avgDE,'descend');
outidx = ii(1:5);