sorting a matrix based on L2 norm of each row
조회 수: 3 (최근 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!