sorting a matrix based on L2 norm of each row
9 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Ameer Hamza
2020-4-23
编辑:Ameer Hamza
2020-4-23
Try this
M = rand(9000); % random matrix for example
[~, idx] = sort(vecnorm(M, 2, 2), 'descend');
M_sorted = M(idx, :);
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!