What does this error mean in the command window: "Maximum recursion limit of 500 reached. Use set(0,'Rec​ursionLimi​t',N) to change the limit" ?

조회 수: 7 (최근 30일)
How do I change the limit if I want to send this email?

답변 (1개)

Rik
Rik 2018년 8월 6일
You actually blotted out the most import part of your code, as the rest is never reached. You run a function that calls itself. That's fine of course, but you must have a method to escape the loop. A classic example is the factorial function:
function answer=my_factorial(val)
if val==1
answer=1;
else
answer=val*my_factorial(val-1);
end
end
See how it makes sure there is an end to this recursion? You need to incorporate that in your function as well.

카테고리

Help CenterFile Exchange에서 Web Services에 대해 자세히 알아보기

제품


릴리스

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by