how to sort the rows of a matrix?

조회 수: 8 (최근 30일)
Stef
Stef 2018년 8월 12일
댓글: Walter Roberson 2018년 8월 12일
I have a matrix RG_table with two columns. I want to sort the rows of the matrix in descending order depending on column 2. Column 2 has values which are non integers. I tried it with sortrows, but I get this error:
Column sorting vector must contain integers with absolute value between 1 and the number of columns in the first argument.
score_sort = sortrows(RG_table, 2, 'descend');
Does anybody know what to do?
  댓글 수: 6
dpb
dpb 2018년 8월 12일
편집: dpb 2018년 8월 12일
Well, no...we have no way to know any such thing.
One guess would be the data on the server isn't the same as that locally...
Again without much more detail and context we're shooting in the dark here.
ADDENDUM
At a minimum, put
whos RG_table
in the function/script before executing the sortrows line on each platform. That will at least be a chance at figuring out what it is you're looking at.
Walter Roberson
Walter Roberson 2018년 8월 12일
Basically the message is telling you that the table is either empty or has only 1 column.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by