Skip to Main Content Skip to Search
Product Documentation

Debugging Errors and Warnings

You can direct the MATLAB software to temporarily stop the execution of an program in the event of a run-time error or warning, at the same time opening a debug window paused at the line that generated the error or warning. This enables you to examine values internal to the program and determine the cause of the error.

Use the dbstop function to have MATLAB stop execution and enter debug mode when any function you subsequently run produces a run-time error or warning. There are three types of such breakpoints that you can set.

Command

Description

dbstop if all error

Stop on any error.

dbstop if error

Stop on any error not detected within a try-catch block.

dbstop if warning

Stop on any warning.

In all three cases, the file you are trying to debug must be in a folder that is on the search path or in the current folder.

You cannot resume execution after an error; use dbquit to exit from the Debugger. To resume execution after a warning, use dbcont or dbstep.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS