How to rearrange row of a matrix based on column value

조회 수: 1 (최근 30일)
sazzad hossen
sazzad hossen 2017년 8월 2일
댓글: sazzad hossen 2017년 8월 2일
I have a matrix v=[1 1 7 35; 2 1 27 55; 3 1 5 50] I would like to rearrange the based on the the 4th column maximum value in chronological order new matrix will be like v=[2 1 27 55; 3 1 5 50; 1 1 7 35]

채택된 답변

Image Analyst
Image Analyst 2017년 8월 2일
Try this:
[~, sortOrder] = sort(v(:,4), 'descend')
v2 = v(sortOrder,:)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Elementary Math에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by