`(y,ind)=sortrows(a)`

Inputs | |

`a` |
A real matrix. |

`y` |
A real matrix of the same size as the input. |

Outputs | |

`ind` |
A vector of the same size as the number of rows in the input. |

For sorting, the ordering of the rows is defined as follows: the row vector

`u`

is defined to be smaller than another row vector `v`

of the same size if
`u[i]<v[i]`

for some `i>1`

and `u[j]=v[j], j=1,..i`

. This ordering is same
as the ordering used for comparision of strings.
The

`ind`

vector is such that the row `i`

of the output is given by `a(ind(i),:)`

.
>>a=[ 4 4 5 5 6> 2 2 4 7 8> 2 2 3 1 5> 4 4 4 2 9];>>sortrows(a)2 2 3 1 5 2 2 4 7 8 4 4 4 2 9 4 4 5 5 6