Sorting matrix based on the sum of the rows
Mostra commenti meno recenti
I am trying to sort the matrix 'counts' (attached as csv) so that the sum of the rows increases to the 512th pixel so that I have effectively lowest sum to highest sum in order
Thank you
Risposta accettata
Più risposte (1)
Bob Thompson
il 9 Lug 2019
1 voto
A = randi(100, 10, 10);
sums = sum(A,2);
[~,I] = sort(sums);
B = A(I',:);
There may be a better way of doing this, but this is the first thing that came to mind. Just replace A with your data.
Categorie
Scopri di più su Shifting and Sorting Matrices in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!