Debugging Errors and Warnings

You can direct the MATLAB® software to temporarily stop the execution of an M-file in the event of a run-time error or warning, at the same time opening a debug window paused at the M-file 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 M-file 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 M-file you are trying to debug must be in a directory that is on the search path or in the current directory.

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

  


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