__max_recursion_depth__
- :
val =__max_recursion_depth__()¶ - :
old_val =__max_recursion_depth__(new_val)¶ - :
old_val =__max_recursion_depth__(new_val, "local")¶ Query or change the ceiling on how deeply functions may call one another recursively.
With no argument the current limit is returned. Given new_val, the new ceiling is installed and the value that was previously in force is returned. When a chain of calls reaches this depth, evaluation is aborted with
MATLAB:maxRecursion("Maximum recursion limit of N reached.") and control is handed back to the prompt, guarding against runaway recursion exhausting the process stack. The default ceiling is 500.Used with the
"local"keyword inside a function, the change applies only for the remainder of that function and anything it calls, and the earlier value is reinstated automatically when the function returns.