How to find second largest OR third largest Or any largest value among the columns of a matrix?
15 ビュー (過去 30 日間)
古いコメントを表示
Furqan Haider
2014 年 10 月 7 日
コメント済み: Kasun Kariyawasam
2018 年 11 月 16 日
I have a matrix A=rand(7,25)
I want to find the second largest/third largest/fourth/fifth and sixth largest value among all the columns of matrix "A". No need of seventh largest as there are total 7 values in each column.
Thank you.
0 件のコメント
採用された回答
Azzi Abdelmalek
2014 年 10 月 7 日
編集済み: Azzi Abdelmalek
2014 年 10 月 7 日
A=rand(7,25)
[aa,indices]=sort(A,'descend')
4 件のコメント
Image Analyst
2014 年 10 月 7 日
They're all in indices. Why do you need different arrays??? If you do, just do
maxIndexes = indices(1,:);
max2Indexes = indices(2,:);
max3Indexes = indices(3,:);
and so on.
Kasun Kariyawasam
2018 年 11 月 16 日
Thanks very much. This is a good one - it gives correct indices of the original array for any max
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!