フィルターのクリア

Ranking numbers in a table and manipulating by division.

2 ビュー (過去 30 日間)
Macy
Macy 2023 年 2 月 12 日
コメント済み: Macy 2023 年 2 月 13 日
I am trying to manually calculate non-exceedance probabilities of each value x. How can I rank the values in this table from smallest to largest and then divide each value by the total number of values (in this case 10). So the highest value (2310) should have a rank of 10 and a non-exceedance probability of 1.
Table = readtable("practice3.xlsx");
x = Table.values
x = 10×1
450 1100 1060 700 350 80 2310 2000 370 50

採用された回答

Voss
Voss 2023 年 2 月 12 日
編集済み: Voss 2023 年 2 月 12 日
Possibly this:
Table = readtable("practice3.xlsx");
[~,idx] = ismember(Table.values,sort(Table.values));
Table.ranks = idx;
Table.non_exceedance_prob = idx/size(Table,1)
Table = 10×3 table
values ranks non_exceedance_prob ______ _____ ___________________ 450 5 0.5 1100 8 0.8 1060 7 0.7 700 6 0.6 350 3 0.3 80 2 0.2 2310 10 1 2000 9 0.9 370 4 0.4 50 1 0.1
  1 件のコメント
Macy
Macy 2023 年 2 月 13 日
Thank you for showing me how to sort the data, I was using "ascend" "descend" and it wasn't exactly getting it exactly right.

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

その他の回答 (0 件)

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by