Error while using Surface Intersection function in a loop "Subscript indices must either be real positive integers or logicals"

조회 수: 2 (최근 30일)
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
Gian Marco Tassi 2017년 10월 5일
https://www.mathworks.com/matlabcentral/fileexchange/48613-surface-intersection
this is the function SurfaceIntersection
J P
J P 2020년 6월 16일
Hi, I am currently having the same issue, did you ever find a fix?

댓글을 달려면 로그인하십시오.

답변 (1개)

James Tursa
James Tursa 2017년 10월 5일
편집: James Tursa 2017년 10월 5일
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).

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by