MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1

Standard Breakpoints


A standard breakpoint pauses at a specified line in a file.


To set a standard breakpoint click the breakpoint alley at an executable line where you
want to set the breakpoint. The breakpoint alley is the narrow column on the left side of
the Editor, to the right of the line number. You also can use the F12 key to set the
breakpoint.


Executable lines are indicated by a — (dash) in the breakpoint alley. If an executable
statement spans multiple lines, you can set a breakpoint at each line in that statement,
even though the additional lines do not have a — (dash) in the breakpoint alley. For
example, in this code, you can set a breakpoint at all four lines:


If you attempt to set a breakpoint at a line that is not executable, such as a comment or a
blank line, MATLAB sets it at the next executable line.


To set a standard breakpoint programmatically, use the dbstop function. For example, to
add a breakpoint at line 2 in a file named myprogram.m, type:


dbstop in myprogram at 2


MATLAB adds a breakpoint at line 2 in the function myprogram.


Set Breakpoints
Free download pdf