Ranking numbers in a table and manipulating by division.

4 次查看(过去 30 天)
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 个)

类别

Help CenterFile Exchange 中查找有关 Descriptive Statistics 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by