It seems that resetting recursion limit is ignored inside parfor. I have a recursive program that will exceed the default 500 limit. I can run it without problem using usual for loop. However, if I change it to parfor, I got the error
Caused by: 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.
And no matter where I put the reset limit command set(0,'RecursionLimit',2000) (inside or outside parfor). I still got the same error message
Best Answer