Hello,
I would like to sort the rows of a matrix depending on the values of each row. So i sould sort the rows based on the first entry of the row, and then i would sort what i have based on the second row and so on. Here is an example, consider the following matrix
A =
1 2 3
1 2 4
3 1 2
1 1 1
The output should be the following
A =
1 1 1
1 2 3
1 2 4
3 1 2

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2020년 5월 14일

1 개 추천

sortrows()

카테고리

도움말 센터File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

제품

질문:

2020년 5월 14일

답변:

2020년 5월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by