find the 3 maximum elements and their index
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
その他の回答 (1 件)
Jonathan Sullivan
2012 年 2 月 29 日
r = rand(100,1);
[val ind] = sort(r,'descend');
val(1:3)
ind(1:3)
r(ind(1:3))
2 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!