
6 Editing and Debugging M-Files
• “Function Alternative for Error Breakpoints” on page 6-132
Setting Error Breakpoints
To set error breakpoints, select Debug > Stop if Errors/Warnings.Inthe
resulting Stop if Errors/Warnings for All Files dialog box, specify error
breakpoints on all appropriate tabs and click OK. To clear error breakpoints,
select the Never stop if ... option for all appropriate tabs and click OK.
For examp
le, to p ause execution w hen a warning occurs, select the Warnings
tab, and
from it select Always stop if warning,thenclickOK.Whenyou
run an M-
file and MATLAB produces a warning, execution pauses, MATLAB
enters d
ebug mode, and the file opens in the E ditor/Debugger at the line that
produc
ed the warning. To remove the warning b rea k p o in t, s elect Never stop
if warn
ing in the Warnings tab and click OK.
Error Breakpoint Types and Options
The fou
r basic types of error breakpoints you can set are Errors , Try/Catch
Errors
, Warnings,andNaN or Inf. Select the Always stop if ... option for
each ta
b to set that type of breakpoint. Se lect the Use message identifiers
... op
tion to limit each type of e rror breakpoint (except NaN or Inf) so that
execu
tion stops only for specific errors.
6-130
Commentaires sur ces manuels