This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Diagnose problems with programs

You can diagnose problems with your MATLAB® program either graphically or programmatically. Both approaches allow you to set breakpoints to pause the execution of your MATLAB program so you can examine values where you think a problem could be.


dbclearRemove breakpoints
dbcontResume execution
dbdownReverse dbup workspace shift
dbquitQuit debug mode
dbstackFunction call stack
dbstatusList all breakpoints
dbstepExecute next executable line from current breakpoint
dbstopSet breakpoints for debugging
dbtypeDisplay file with line numbers
dbupShift current workspace to workspace of caller in debug mode
keyboardInput from keyboard
echoDisplay statements during function execution


Debug a MATLAB Program

To debug your MATLAB program graphically, use the Editor/Debugger. Alternatively, you can use debugging functions in the Command Window.

Set Breakpoints

Set breakpoints in MATLAB to pause at a specified line in a file, at a specified line in a file only when the specified condition is met, or when MATLAB encounters an error.

Examine Values While Debugging

While your program is paused, view the value of any variable currently in the workspace to see if a line of code produces the expected result.