how do i get the top 10 percent of the matrix value
26 views (last 30 days)
Show older comments
jun xian ng
on 20 Oct 2015
Commented: Star Strider
on 20 Oct 2015
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?
0 Comments
Accepted Answer
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
More Answers (1)
Walter Roberson
on 20 Oct 2015
V = sort(YourMatrix(:), 'reverse');
Top10 = V(1:ceil(end/10));
0 Comments
See Also
Categories
Find more on Matrix Indexing 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!