필터 지우기
필터 지우기

Ranking numbers in a table and manipulating by division.

조회 수: 4 (최근 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개)

카테고리

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