MATLAB: Array sorting 2D

arraymatrixmatrix manipulationsorting

Lets say I had a matrix A
A = [ 5,2,3,6,8;
3,9,5,7,2;
4,3,2,1,11]
so that when i sorted the matrix then becomes
A = [1,2,3,4,11;
2,3,5,6,8;
2,3,5,7,9;]

Best Answer

A = sortrows(sort(A,2));