sortrows problem, i can't run my code file

11 Ansichten (letzte 30 Tage)
SHIN,LIN HO
SHIN,LIN HO am 28 Feb. 2018
Kommentiert: Walter Roberson am 13 Aug. 2018
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 Kommentare
Steven Lord
Steven Lord am 12 Aug. 2018
Stef, please show your exact call to sortrows.
Walter Roberson
Walter Roberson am 13 Aug. 2018
Your call to sortrows() is requesting sorting on column 11, but you only have two columns.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Jos (10584)
Jos (10584) am 13 Aug. 2018
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).

Kategorien

Mehr zu Shifting and Sorting Matrices finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by