Error "not enough input arguments" in length function
이전 댓글 표시
I am trying to run a code but receiving an error at the 4th line with 'not enough input' for the length function. What can be inserted in further to remove the error.
function [coef] = ComputeCurve_EDIT (SUBJRAWSubj1S1)
coef = [];
i = 1; % matrix row index
NRrows = Length (SUBJRAWSubj1S1);
while (i <= NRrows) % while not end of matrix
x = []; % initialize to-be-filled vectors
y = [];
xnorm = [];
ynorm = [];
n = i; % keeps track of the number of samples on a given trial
trialNR = SUBJRAWSubj1S1 (i, 1);
while (SUBJRAWSubj1S1 (i, 1) == trialNR) % fill x and y coordinate vectors
x = [x; SUBJRAWSubj1S1 (i, 2)];
y = [y; SUBJRAWSubj1S1 (i, 3)];
i = i + 1;
if (i> NRrows)
break
end
end
댓글 수: 3
Spell "length" correctly ... MATLAB is case-sensitive and you capitalized it...
NB: length() is potentially dangerous unless it is used on only vectors -- it returns max(size(x)) which for a 2D input can be either size(x,1) or size(x,2) depending on whether is taller or wider in aspect.
Use size(x,D) for the dimension of interest for more reliable code.
Tanaya Chatterjee
2020년 6월 21일
dpb
2020년 6월 21일
As said, if you are concerned about the rows, that's dimension 1 so the 'D' argument to size would be one.
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!