suppose I have one a=nXm matrix and the the function values of a is saved in another matrix b. Now I want to sort matrix a on basis of their function evaluation. or how can I get the nth max or min values of matrix b with the position.