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
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