sorting a matrix based on L2 norm of each row
9 views (last 30 days)
Show older comments
Hello all
Please how to code; descendent sorting a matrix C(9000x9000) based on L2 norm of each row then reconstruct a new ranked matrix.
Thanks in advance
0 Comments
Accepted Answer
Ameer Hamza
on 23 Apr 2020
Edited: Ameer Hamza
on 23 Apr 2020
Try this
M = rand(9000); % random matrix for example
[~, idx] = sort(vecnorm(M, 2, 2), 'descend');
M_sorted = M(idx, :);
2 Comments
More Answers (1)
See Also
Categories
Find more on Shifting and Sorting 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!