필터 지우기
필터 지우기

tiedrank in descending order?

조회 수: 6 (최근 30일)
Ekin Ceyda Cetin
Ekin Ceyda Cetin 2017년 2월 27일
댓글: Peter Dodds 2019년 4월 7일
Is there any way to use tiedrank in descending order? I need to rank the highest value as the smallest one in rank. Is it possible to do this using tiedrank or another built-in-function? Thank you~~
  댓글 수: 1
Peter Dodds
Peter Dodds 2019년 4월 7일
To do this in one line, just negate the vector. For example:
>> counts = [23, 1, 17, 95, 133];
>> ranks = tiedrank(-counts);
>> ranks
ranks =
3 5 4 2 1

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

채택된 답변

Sid Jhaveri
Sid Jhaveri 2017년 3월 2일
Hi Ekin,
You can the reverse the order of ranking programmatically as follows:
%Store the result of tiredrank function in "a"
a = tiedrank([10 20 30 40 20]);
%Find the largest rank value of "a", increment it by 1 and subtract "a" by
%this value.
ranks_desc = (max(a)+1) - a;
This will just reverse the ranking received by "tiedrank" function.

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by