필터 지우기
필터 지우기

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.
Kasun Kariyawasam
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 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