MATLAB Answers

Ranking matrix by rows

11 views (last 30 days)
Hi,
I have a 3x3 matrix. I want to create a matrix that shows the magnitude rank of the elements in the rows with 1 being the maximum and 3 being the minimum. for example:
a = [3 4 1; 5 1 8; 8 4 1]
b = [2 1 3; 2 3 1; 1 2 3]
Any help would be appreciated!
Sushma

  0 Comments

Sign in to comment.

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 11 Feb 2015
Edited: Azzi Abdelmalek on 11 Feb 2015
EDIT
[~,jj]=sort(a,2,'descend');
[~,b]=sort(jj,2)

  0 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.