sorting a matrix based on L2 norm of each row
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
riad didou
am 23 Apr. 2020
Kommentiert: Ameer Hamza
am 24 Apr. 2020
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 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 23 Apr. 2020
Bearbeitet: Ameer Hamza
am 23 Apr. 2020
Try this
M = rand(9000); % random matrix for example
[~, idx] = sort(vecnorm(M, 2, 2), 'descend');
M_sorted = M(idx, :);
2 Kommentare
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Shifting and Sorting Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!