recursive function causes matab to crash

조회 수: 14 (최근 30일)
H D
H D 2016년 8월 4일
답변: Steven Lord 2016년 8월 4일
I increased the recursion using set parameter but the recursive function cause matlab to crash using different input parameters. All the variables are defined as global to reduce data duplication in memory. Can any body help me to solve this issue?
  댓글 수: 1
James Tursa
James Tursa 2016년 8월 4일
We need to see your code. Define "crash" ... what actually happens exactly?

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

답변 (1개)

Steven Lord
Steven Lord 2016년 8월 4일
In earlier releases of MATLAB (I tried this in release R2014b) the error you received when you tried to perform recursion too many levels deep was:
Maximum recursion limit of 500 reached. Use set(0,'RecursionLimit',N) to
change the limit. Be aware that exceeding your available stack space can
crash MATLAB and/or your computer.
Sometime between then and now (release R2016a) it looks like we changed the message in at least some cases.
Out of memory. The likely cause is an infinite recursion within the program.
The best solution IMO is to avoid recursing that deeply. If you describe the problem you're trying to solve recursively, someone may be able to offer guidance on how to solve that using less recursion or no recursion at all.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by