Hello,
Given the matrix M
1 5 4
2 4 6
3 8 5
4 2 7
and the vector V 4,2,1,3, I would like to order the rows in M according
to the indices in V, that is, I want output
4 2 7
2 4 6
1 5 4
3 8 5
How do I do this? This is not a standard ascending or descending sort.
Dan
On 1/2/2006 5:26 PM, Daniel Pick wrote: > Hello, > Given the matrix M > 1 5 4 > 2 4 6 > 3 8 5 > 4 2 7 > > and the vector V 4,2,1,3, I would like to order the rows in M according > to the indices in V, that is, I want output > > 4 2 7 > 2 4 6 > 1 5 4 > 3 8 5 > > How do I do this? This is not a standard ascending or descending sort. I think M[V,] is all you need. Duncan Murdoch