MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1

  • There are unsaved changes in the file. To make breakpoints valid, save the file. The
    gray breakpoints become red, indicating that they are now valid.

  • There is a syntax error in the file. When you set a breakpoint, an error message
    appears indicating where the syntax error is. To make the breakpoint valid, fix the
    syntax error and save the file.


Disable Breakpoints


You can disable selected breakpoints so that your program temporarily ignores them and
runs uninterrupted. For example, you might disable a breakpoint after you think you
identified and corrected a problem, or if you are using conditional breakpoints.


To disable a breakpoint, right-click the breakpoint icon, and select Disable Breakpoint
from the context menu.


An X appears through the breakpoint icon to indicate that it is disabled.


To reenable a breakpoint, right-click the breakpoint icon and select Enable Breakpoint
from the context menu.


The X no longer appears on the breakpoint icon and program execution pauses at that
line.


To enable or disable all breakpoints in the file, select Enable All in File or Disable All
in File. These options are only available if there is at least one breakpoint to enable or
disable.


Clear Breakpoints


All breakpoints remain in a file until you clear (remove) them or until they are cleared
automatically at the end of your MATLAB session.


To clear a breakpoint, right-click the breakpoint icon and select Clear Breakpoint from
the context menu. You also can use the F12 key to clear the breakpoint.


To clear a breakpoint programmatically, use the dbclear function. For example, to clear
the breakpoint at line 6 in a file called myprogram.m, type


Set Breakpoints
Free download pdf