matlab sorting rows by one column
>> A = [1,1,1;0,0,0;2,2,2]
A =
1 1 1
0 0 0
2 2 2
>> [~,idx] = sort(A(:,1))
idx =
2
1
3
>> A = A(idx,:)
A =
0 0 0
1 1 1
2 2 2
>>