MATLAB: How to sort only first column in matlab

MATLAB

X=0.5 1.0;0.1 2;2.5 4 output must be like 0.1 2;0.5 1.0;2.5 4

Best Answer

Use the sortrows funciton:
X = [0.5 1.0;0.1 2;2.5 4];
Output = sortrows(X, 1)
Output =
0.1 2
0.5 1
2.5 4