Search code examples
matlabdebuggingbreakpoints

How to stop Matlab from starting the debugger when you interrupt code execution


When I interrupt code in Matlab (+. on MacOS), it automatically starts the debugger and opens the function it was currently evaluating. Is there a way to turn this feature off? I'm currently working with different starting points for an fsolve optimization and opening the fsolve.m file when I stop the evaluation is annoying and completely useless.

EDIT: The breakpoints option "stop on errors" is already disabled. Under the debugger preferences, turning on/off the option for opening files when Matlab reaches a breakpoint doesn't solve the problem either.

I'm using Matlab R2014b in case that helps.


Solution

  • You can do it programatically by running the command:

    dbclear if error
    

    If you want to turn it on again, use

    dbstop if error. 
    

    There are more debugger options to these commands, as it can be seen in this other SO Q&A and in the documentation of dbstop and dbclear