find the 3 maximum elements and their index
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
hi everyone, i have a vector and i need to find the 3 maximum elements and their index, plz can anyone help me in that? thx
0 Commenti
Risposta accettata
Più risposte (1)
Jonathan Sullivan
il 29 Feb 2012
r = rand(100,1);
[val ind] = sort(r,'descend');
val(1:3)
ind(1:3)
r(ind(1:3))
2 Commenti
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!