MATLAB Answers

How to rank data in a whole matrix

19 views (last 30 days)
Fred
Fred on 18 Dec 2012
Hi, I need to rank the data in a matrix but tiderank function does it for each column separately. how can I do it for all data in all rows and columns together? in a way that first cell of first column is first rank and last cell of last column is last rank.
Thank you

  0 Comments

Sign in to comment.

Accepted Answer

the cyclist
the cyclist on 19 Dec 2012
If A is your matrix, then
>> reshape(sort(A(:)),size(A))
should do it. You can use the 'descend' argument to the sort function if you wanted largest to smallest.

  0 Comments

Sign in to comment.

More Answers (1)

Fred
Fred on 19 Dec 2012
thank you reshape(tiedrank(A(:)),size(A)) was what I needed

  0 Comments

Sign in to comment.

Sign in to answer this question.

Products


Translated by