Consider I have a large matrix (say 24*30), is there a way to find the three largest values?
I know that we can find the biggest value using this command:
max(A, [], 'all')
But is there another way around this?

 채택된 답변

Star Strider
Star Strider 2021년 3월 29일

2 개 추천

If you have R2017b or later, the maxk function will likely be useful.

댓글 수: 4

Youssef Chehade
Youssef Chehade 2021년 3월 29일
I tried it, but it is giving me the biggest element in each column. So giving me 30 values if i set k to 1
maxk(A(:),3)
Youssef Chehade
Youssef Chehade 2021년 3월 29일
Oh wow, thank you so much
Star Strider
Star Strider 2021년 3월 29일
As always, my pleasure!
Matt J — Thank you for the amplification.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

태그

질문:

2021년 3월 29일

댓글:

2021년 3월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by