Error while using Surface Intersection function in a loop "Subscript indices must either be real positive integers or logicals"
显示 更早的评论
Hi everybody, I am struggling with the last part of my Script. I attach here the error and the correlated part of the script.
Script:
for ind1=1:length(Slicesurf)
for ind2=1:(ncontour*2)
[~, intersection] = SurfaceIntersection(Slicesurf(ind1),Htot(ind2));
Infill(ind1,ind2).faces=intersection.faces;
Infill(ind1,ind2).vertices=intersection.vertices;
Infill(ind1,ind2).edges=intersection.edges;
end
end
the curious thing is that the loop goes well for a few rounds but then it stops and give me this error. ncontour and lenght(Slicesurf) are both real and positive. Slicesurf contains all surfaces parallel to xy plane and Htot contains 3D parabolas.
Error:
"Subscript indices must either be real positive integers or logicals.
Error in SurfaceIntersection>TriangleIntersection3D_Moller (line 367)
a2 = lut(sign(du)*[9; 3; 1] + 14); % calculate the key and call the look-up table
Error in SurfaceIntersection (line 218)
[intMatrix(tMsk), intSurface] = TriangleIntersection3D_Moller(...
Error in SurfaceIntersection_prova13 (line 166)
[~, intersection] = SurfaceIntersection(Slicesurf(ind1),Htot(ind2));"
can someone help me? I am going crazy with this error!
Thanks a lot!
2 个评论
Gian Marco Tassi
2017-10-5
J P
2020-6-16
Hi, I am currently having the same issue, did you ever find a fix?
回答(1 个)
James Tursa
2017-10-5
编辑:James Tursa
2017-10-5
0 个投票
Often this is the result of having a variable with the same name as a MATLAB function you are using, so the variable is shadowing the MATLAB function. E.g., maybe you have inadvertently created a variable named "sign" and "du" is not an integer when you encounter sign(du).
类别
在 帮助中心 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!