MATLAB: Sort a Matrix based on a column

sort

I want to sort a matrix. Actually I want to sort the last column and all the rest columns based on the last. Has anyone idea about this???

Best Answer

[lastvals, idx] = sort(A(:,end));
sortedA = A(idx,:);
Related Question