# List the 10% highest values of a distribution

1 Ansicht (letzte 30 Tage)
Alessandro Ruda am 2 Mär. 2021
Kommentiert: Jan am 2 Mär. 2021
Dear MatLab comunity,
I would like to obtain a list of values that are within 10% the highest value of the distribution that I have. The data is a list of aminoacids of a protein and their associated root mean square fluctuation.
My idea tough was to have not only the values of RMSF but also the residue associated with it in the list, so that I knew which value belongs to each residue.
So like:
[
Residue 234 3.3301
Residue 121 2.5150
...
et cetera
]
Here's the beginning of the script, I can get a list out of the 10% highest values but I need the association with the residue.
n = RMSF(:,1); %number of residue
x = RMSF(:,2); %RMSF for given residue
figure
hold on
title('RMSF UDP');
w1 = 0.5;
bar(n,x,w1,'FaceColor','r')
xlabel('Residue');
ylabel('RMSF');
xlim([0 364])
ylim([0 5])
%%
Ms = sort(x_UDP,'descend'); % Sort Descending
Result = Ms(1:ceil(length(Ms)*0.1))
Hope I have been somehow clear in stating the problem. Any suggestion about this would be highly appreciated!
All the best,
Alex
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Jan am 2 Mär. 2021
Bearbeitet: Jan am 2 Mär. 2021
I guess that "x_UDP" is the same as "x".
n = RMSF(:,1); %number of residue
x = RMSF(:,2); %RMSF for given residue
[Ms, index] = sort(x, 'descend');
Result = Ms(1:ceil(length(Ms)*0.1));
Result2 = n(index(1:ceil(length(Ms)*0.1)));
% Or easier:
RMSF_sorted = sortrows(RMSF, 2, 'descend');
Result = RMSF_sorted(1:ceil(size(RMSF, 1) * 0.1), :)
##### 2 KommentareKeine anzeigenKeine ausblenden
Alessandro Ruda am 2 Mär. 2021
Thank you very much for your reply! can ask you instead what would it be for the opposite case where I instead would like to list all the values within 10% of the lowest one?
In that case should I sort the list in the opposite order? Like:
RMSF_sorted = sortrows(RMSF, 2, 'ascend');
Result = RMSF_sorted(1:ceil(size(RMSF, 1) * 0.1), :)
Jan am 2 Mär. 2021
Yes.

Melden Sie sich an, um zu kommentieren.

### Weitere Antworten (1)

Veronica Taurino am 2 Mär. 2021
Change the last part:
[Ms, idx] = sort(x,'descend'); % Sort Descending
Result = Ms(1:ceil(length(Ms)*0.1));
idx_result = idx(1:length(Result));
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu t Location-Scale Distribution finden Sie in Help Center und File Exchange

R2017a

### Community Treasure Hunt

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

Start Hunting!

Translated by