MATLAB Answers


I'm getting a windows error rather than the recursion limit error

Asked by Pepijn
on 19 Jan 2013

I'm a student assistant at University of Twente, and while reviewing work of my students I stumped on a failure at my own matlab. If I should get an error thanx to the recursion limit (IE: recursion limit reached, you can reset it but it might crash your computer and matlab... lovely error) I don't get that message but Matlab just closes. IE) function [ result ] = test( x ) result = test(x); Gets Windows to close my Matlab without getting the recursionlimit-error.

I rechecked my recursion limit by get(0,'RecursionLimit') but that just gives me an answer of '500'. Which should be fine.

But in stead of the normal matlab-error-message I get a windows-error-message saying 'a problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available' Proper recursion codes work normally, it's specificly the ones that I know will get into an infinite loop.

(FYI: I'm running a legal windows 7 and Matlab 7.12.0 R2011a with university licence)

Any idea's?


Log in to comment.

1 Answer

Answer by Walter Roberson
on 19 Jan 2013
 Accepted Answer

Sounds to me like MATLAB is running out of memory in a situation that is not (for whatever reason) nicely caught. MATLAB's recursion limit is designed to assist in finding program bugs, but is not promised to be fool-proof.


Tried 'clear' and 'clear all' due to your suggestion, did not fix it. Though your suggestion did get me to try to reset the recursion limit. First at 10, working up till 400. 450 crashes, but 400 works fine for what I'll need it for.

Thanx for contributing the food for thought :)

I don't recall ever suggesting "clear all". Sometimes running out of memory cannot be avoided.

Log in to comment.

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!