Debugging
The Matlab GUI editor is also the debugger.
To debug Matlab code :
- Open the .m file containing the Matlab commands.
- Set breatpoints where you want matlab to stop when the script is executed.. To do this, place the cursor at
the line where you want to set the breakpoint, and then select the Debug/Set-Clear Breakpoint menu item.
One can also tell Matlab to stop at an error by selecting the Debug/Stop if Error menu item.
- Execute the Matlab script from the command window. When a breakpoint is hit, normal processing is suspended,
and window focus is passed to the editing/debugging window. One uses the window controls to step through the script.
- Viewing the values of the variables consists of highlighing the variables and then selecting View/Evaluate
Selection. The output of this process appears in the command window.
UCLA Mathematics Department |
©2000 |