MATLAB: Sorting matrix based on the sum of the rows

MATLABmatrixrowssortsum

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

Best Answer

Like this?
% Read data from CSV
A = csvread('Counts.csv');
% Calculate order vector (pt) based on sum(A,2)
[~,pt] = sort(sum(A,2));
% Sort the matrix
B = A(pt,:);