필터 지우기
필터 지우기

Maximum recursion limit of 500 reached

조회 수: 7 (최근 30일)
Jason
Jason 2016년 3월 3일
답변: Steven Lord 2016년 3월 3일
Dear all, I met a problem when using the following code. I met a problem in the following code.
Error using sdpvar/reshape (line 27)
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.
my code is :
limpr=sdpvar(S*A,1); % limpr represents for the limiting probability of transition probability matrix;
z1=binvar(n+1,1);
z2=binvar(n+1,1);
z3=binvar(n+1,1);
F=[Aeq*limpr==beq,limpr>=0,sum(z1)==1,sum(z2)==1,sum(z3)==1];
lpmat1=sum(reshape(limpr,A,S)); % build the sum of limiting probability matrix of all states
lpmat=reshape(lpmat1,n+1,n+1,n+1);
in the last step, it gives this information. I have tried to set the limit to 10000 (for example), but the program crashed out.
Do you know how to deal with problem, Thank you very much!
  댓글 수: 1
Adam
Adam 2016년 3월 3일
Unless you are intentionally writing a recursive function that error usually implies you did something wrong in your syntax and probably have accidental infinite recursion so following its advice on increasing the recursion limit is rarely the desired solution.

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

답변 (2개)

Philip Borghesani
Philip Borghesani 2016년 3월 3일
Is sdpvar a class and does it have a reshape method? If so it is getting called in a way that is causing it to call itself infinitely, probably instead of an attempted call to the builtin reshape function.
I just found this class (sdpvar) in the Yalmip toolbox, there may be a bug in the toolbox or you may be using it incorrectly. It may be that your code needs to call builtin('reshap',...) to avoid calling the classes method. In the future information on what toolboxes you are using and better descriptions of your code would be helpful.

Steven Lord
Steven Lord 2016년 3월 3일
Are you using this third-party toolbox named YALMIP? If so you probably want to contact the authors and/or maintainers via that page for help determining why sdpvar's reshape method is calling itself recursively that many times.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by