tiedrank in descending order?

9 ビュー (過去 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.
  1 件のコメント
Ekin Ceyda Cetin
Ekin Ceyda Cetin 2017 年 3 月 7 日
Thank you.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by