function sortrows - sorting strings:
The function sortrows sorts each and every row as a block, or group, and it also will work on numbers. Here in this illustration the rows starting with 3 and 4 are placed first then, for the rows starting with 5, the values in the second column (6 and7) determine the order.
>> mat = [5 7 2; 4 6 7; 3 4 1; 5 6 2]
mat =
5 7 2
4 6 7
3 4 1
5 6 2
>> sortrows(mat)
ans =
3 4 1
4 6 7
5 6 2
5 7 2