MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1
software pauses at the start of the line. Or, alternatively, you can set a breakpoint for each
anonymous function in the line.

When you add a breakpoint to a line containing an anonymous function, the Editor asks
where in the line you want to add the breakpoint. If there is more than one breakpoint in
a line, the breakpoint icon is blue, regardless of the status of any of the breakpoints on
that line.

To view information about all the breakpoints on a line, hover your pointer on the
breakpoint icon. A tooltip appears with available information. For example, in this code,
line 5 contains two anonymous functions, with a breakpoint at each one. The tooltip tells
us that both breakpoints are enabled.

When you set a breakpoint in an anonymous function, MATLAB pauses when the
anonymous function is called. A green arrow shows where the code defines the
anonymous function. A white arrow shows where the code calls the anonymous functions.
For example, in this code, MATLAB pauses the program at a breakpoint set for the
anonymous function sqr, at line 2 in a file called myanonymous.m. The white arrow
indicates that the sqr function is called from line 3.

Invalid Breakpoints


A gray breakpoint indicates an invalid breakpoint.

Breakpoints are invalid for these reasons:

22 Debugging MATLAB Code

Free download pdf