Installation guide

Debugging Process a nd Features
Debugging Process and Features
In this section...
“Ways to Debug M-Files” on page 6-103
“Preparing for Debugging” on page 6-103
“Setting Breakpoints” on page 6-107
“Running an M-File with Breakpoints” on p age 6-111
“Stepping Through an M-File” on page 6-112
“Examining Values” on page 6 -114
“Correcting Problems and Ending Deb u gg ing” on page 6-118
“Conditional Breakpoints” on page 6-126
“Breakpoints in Anonymous Functions” o n page 6-128
“Error Breakpoints” on page 6-129
Ways to Debug M-Files
You can debug the M-files using the E ditor/Debugger, which is a graphical
user interface, as well as by using de b ugging functions from the Command
Window. You can use both m ethods interchangeably. These to pics and the
example describe both methods.
Preparing for Debugging
Do the following to prepare for debugging:
Openthefile—TousetheEditor/Debugger for debugging, open it with
thefiletorun.
Save chan ge s If you are editing the file, save the changes before you
begin debugging. If you try to run a file w ith unsaved changes from w ithin
the Editor/Debugger, the file is automatically saved before it runs. If you
run a fil e with uns aved changes f r om the Comma nd Window, MATLAB run s
the saved version of the file, so you w i ll not see the results of your changes.
Add the files to a directory on the search path or put them in the current
directory Be sure the f ile you run a nd any f iles it calls are in directories
6-103