Possible Duplicate:
Sort a matrix with another matrix
The Matrix A (’10 x 1000′ all numbers) look like this:
score(1.1) score(1.2) score(1.3)….score(1.1000)
score(2.1) score(2.2) score(2.3)….score(1.1000)
…
The Matrix B (‘1 x 1000’ all numbers):
Return(1) Return(2) Return(3) …..Return(1.1000)
Every time I sort a row of Matrix A, I want to sort Matrix B based on the order of the sorted row in Matrix A. Because there are 10 rows in Matrix A, Matrix B will be sorted 10 times and generate a new Matrix C (’10 x 1000′) like this: (I am looking for a script to generate this Matrix C)
Return(3) Return(25) Return(600) …….Return(1000)
Return(36)Return(123) Return(2)……..Return(212)
….
….
This should do what you want:
Now the rows of
Aare sorted, and the rows ofCcontain the corresponding sortedB.