How to find second largest OR third largest Or any largest value among the columns of a matrix?

15 次查看(过去 30 天)
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.

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2014-10-7
编辑:Azzi Abdelmalek 2014-10-7
A=rand(7,25)
[aa,indices]=sort(A,'descend')
  4 个评论
Image Analyst
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by