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.
Debugging using the graphical debugger is not supported in live scripts. For more information, see What Is a Live Script?.
|Reverse dbup workspace shift|
|Quit debug mode|
|Function call stack|
|List all breakpoints|
|Execute next executable line from current breakpoint|
|Set breakpoints for debugging|
|Display file with line numbers|
|Shift current workspace to workspace of caller in debug mode|
|Input from keyboard|
|Display statements during function execution|
To debug your MATLAB program graphically, use the Editor/Debugger. Alternatively, you can use debugging functions in the Command Window.
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.
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.