Maximum Recursion limit of 500 Reached Error.
이전 댓글 표시
I am using this code to plot number of circles. However, when I run it says that Maximum recursion limit of 500 reached. Use set(0,'RecursionLimit',N) to change the limit. How to correct this error?
function h = circle3(x,y,r)
d = r*2;
px = x-r;
py = y-r;
h = rectangle('Position',[px py d d],'Curvature',[1,1]);
daspect([1,1,1])
for i =1:20
x=0 + (5+5)*rand(1)
y=0 + (5+5)*rand(1)
r=0.5
circle3(x,y,r)
hold on
end
답변 (2개)
James Tursa
2018년 2월 2일
편집: James Tursa
2018년 2월 2일
2 개 추천
You need to rewrite your logic so that your circle3 function has a way to return to the caller. As it is now, the only thing that circle3 does is call circle3, which calls circle3, which calls circle3, etc.
The code which invokes circle3() should be placed elsewhere. circle3() should contain only the following,
function h = circle3(x,y,r)
d = r*2;
px = x-r;
py = y-r;
h = rectangle('Position',[px py d d],'Curvature',[1,1]);
daspect([1,1,1])
end
댓글 수: 1
Matt J
2018년 2월 2일
카테고리
도움말 센터 및 File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!