sorting a matrix based on L2 norm of each row
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
riad didou
il 23 Apr 2020
Commentato: Ameer Hamza
il 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 Commenti
Risposta accettata
Ameer Hamza
il 23 Apr 2020
Modificato: Ameer Hamza
il 23 Apr 2020
Try this
M = rand(9000); % random matrix for example
[~, idx] = sort(vecnorm(M, 2, 2), 'descend');
M_sorted = M(idx, :);
2 Commenti
Più risposte (1)
Vedere anche
Categorie
Scopri di più su Shifting and Sorting Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!