Ranking matrix by rows
조회 수: 4 (최근 30일)
이전 댓글 표시
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
채택된 답변
Azzi Abdelmalek
2015년 2월 11일
편집: Azzi Abdelmalek
2015년 2월 11일
EDIT
[~,jj]=sort(a,2,'descend');
[~,b]=sort(jj,2)
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!