HELP: Index in position 2 is invalid. Array indices must be positive integers or logical values.

조회 수: 1 (최근 30일)
I got this error in my code file: "Index in position 2 is invalid. Array indices must be positive integers or logical values."
It refers to these lines:
Index in position 2 is invalid. Array indices must be positive integers or logical values.
Error in straighten>getInterpolatedValue (line 65)
I(1,1) = IM(x(1),y(1))*(1-x(3))*(1-y(3));
Error in straighten (line 50)
IM2(ct,ct2) = getInterpolatedValue(IM,xStart,yStart);
Error in test7 (line 68)
IM2 = straighten(IM,[x;y]',450);
I've tried checking if I entered the equation wrong or if I have to save certain values as integers but nothing seems to work.I have attached 2 files of my code. What should I do to fix this error? Any advice would be greatly appreciated.

답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2022년 3월 20일
Your fcn file straighten.m that contains one crucial mistake, i.e.:
The command in it on line 10 has a conflict:
IM2(:,:,ct)=straighten(IM(:,:,ct),pts,width); that must be fixed.
Note that the same function within the same function file can't called.

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by