How to sort a two column vector
이전 댓글 표시
I need to order this two column vector (attached) in such a way that the first column (x) is ordered ascending and the second column follows this order. In other words, it is very important to me that the values in the second column remain the same for each value of x.
Thanks in advance.
댓글 수: 4
dpb
2020년 6월 2일
s=sortrows(x);
dpb
2020년 6월 2일
Of course it worked... <VERY big grin> ...
Stephen23
2020년 6월 11일
Original question by Jórdan Venâncio Leite on 2nd June 2020 retrieved from Google Cache (uploaded data could not be retrieved):
"How to sort a two column vector"
I need to order this two column vector (attached) in such a way that the first column (x) is ordered ascending and the second column follows this order. In other words, it is very important to me that the values in the second column remain the same for each value of x.
Thanks in advance.
Rena Berman
2020년 10월 12일
(Answers Dev) Restored edit
답변 (2개)
카테고리
도움말 센터 및 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!