Filter löschen
Filter löschen

Ranking numbers in a table and manipulating by division.

3 Ansichten (letzte 30 Tage)
Macy
Macy am 12 Feb. 2023
Kommentiert: Macy am 13 Feb. 2023
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

Akzeptierte Antwort

Voss
Voss am 12 Feb. 2023
Bearbeitet: Voss am 12 Feb. 2023
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 Kommentar
Macy
Macy am 13 Feb. 2023
Thank you for showing me how to sort the data, I was using "ascend" "descend" and it wasn't exactly getting it exactly right.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Descriptive Statistics finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by