Let's say I have an array A = [ 41 13 22 18 32]
How can I get the indexes of the three greatest values?
In this example I expect to get 1,5,3 (indexes of 41,32,22).
Thanks!
According to this documentation:
A = [ 41 13 22 18 32];
[val idx]=sort(A,'descend');
top3_idx=idx(1:3)
It works in Octave online
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.