sortrows problem, i can't run my code file

Error using matlab.internal.math.sortrowsParseInputs>legacyParseCOL (line 106) Column sorting vector must contain integers with absolute value between 1 and the number of columns in the first argument.
Error in matlab.internal.math.sortrowsParseInputs (line 29) [col,colProvided] = legacyParseCOL(col,n,in2);
Error in sortrows (line 60) [col, nanflag, compareflag] = matlab.internal.math.sortrowsParseInputs(A,varargin{:});
Error in Final02 (line 37) Bigsize_sortcharactor=sortrows(Bigsize,11); >>

댓글 수: 4

Geoff Hayes
Geoff Hayes 2018년 2월 28일
What can you tell us about Bigsize? Please describe the dimensions, the data type, etc.
Stef
Stef 2018년 8월 12일
Hi Geoff I have the same problem. My matrix is a 50000 x 2 matrix where the first column includes a dummy variable(either +1 or -1) and the second column includes small values between -2 and 2 (non integers as well). I want to sort the matrix according to column 2.
Steven Lord
Steven Lord 2018년 8월 12일
Stef, please show your exact call to sortrows.
Your call to sortrows() is requesting sorting on column 11, but you only have two columns.

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

답변 (1개)

Jos (10584)
Jos (10584) 2018년 8월 13일

0 개 추천

This replicates when the input to sortrows is not what you think it is.
A = [3 ; 1 ; 2] % 1 column only
sortrows(A, 2) % -> errors as observed above
You could (should?) check the dimensions of A first using
size(A,2)
@Mathworks: why don't you make this error less cryptic by stating (more) explicitly that the first argument has less columns than the column sorting vector (especially when this is already a positive integer).

카테고리

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

태그

질문:

2018년 2월 28일

댓글:

2018년 8월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by