Is there any way to code this on a different way?

조회 수: 1 (최근 30일)
flashpode
flashpode 2022년 2월 16일
댓글: flashpode 2022년 2월 16일
I want to get the max value of a variable and the number #100(max). I got this code:
[b,index] = maxk(lat1,100);
b_new = b([1,100])
Is there any way to write it to get directly the #1 and #100?
  댓글 수: 2
Walter Roberson
Walter Roberson 2022년 2월 16일
I wonder if you want max(lat1, 100)
flashpode
flashpode 2022년 2월 16일
I want #1 and #100 and its indices

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

채택된 답변

Jan
Jan 2022년 2월 16일
No. This is the efficient solution already. To get the 100.th most frequent element, you have to determine the frequencies of all other elements also.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by