Filter löschen
Filter löschen

Maximum recursion limit of 500 reached

7 Ansichten (letzte 30 Tage)
Jason
Jason am 3 Mär. 2016
Beantwortet: Steven Lord am 3 Mär. 2016
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 Kommentar
Adam
Adam am 3 Mär. 2016
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.

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Philip Borghesani
Philip Borghesani am 3 Mär. 2016
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 am 3 Mär. 2016
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.

Community Treasure Hunt

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

Start Hunting!

Translated by