how do i get the top 10 percent of the matrix value

4 views (last 30 days)
so basically I have a matrix of 20x20. I need to extract out the top 10 percentage of the value and put it into a vector form. how should I do it?

Accepted Answer

Star Strider
Star Strider on 20 Oct 2015
This seems to do what you want:
M = randn(20); % Create Data
Ms = sort(M(:),'descend'); % Sort Descending
Result = Ms(1:ceil(length(Ms)*0.1)); % Desired Output
  4 Comments

Sign in to comment.

More Answers (1)

Walter Roberson
Walter Roberson on 20 Oct 2015
V = sort(YourMatrix(:), 'reverse');
Top10 = V(1:ceil(end/10));

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!