Using Simulink Previous page   Next Page

Setting Breakpoints

The Simulink debugger allows you to define stopping points in a simulation called breakpoints. You can then run a simulation from breakpoint to breakpoint, using the debugger's continue command. The debugger lets you define two types of breakpoints: unconditional and conditional. An unconditional breakpoint occurs whenever a simulation reaches a method that you specified previously. A conditional breakpoint occurs when a condition that you specified in advance arises in the simulation.

Breakpoints are useful when you know that a problem occurs at a certain point in your program or when a certain condition occurs. By defining an appropriate breakpoint and running the simulation via the continue command, you can skip immediately to the point in the simulation where the problem occurs.

Setting Unconditional Breakpoints

You can set unconditional breakpoints from the

Setting Breakpoints from the Debugger Toolbar

To set a breakpoint on a block's methods, select the block and then click the Breakpoint button on the debugger toolbar.

The debugger displays the name of the selected block in the Break/Display points panel of its Breakpoints pane.

You can temporarily disable the breakpoints on a block by deselecting the check box in the breakpoints column of the panel. To clear the breakpoints on a block and remove its entry from the panel, select the entry and then click the Remove selected point button on the panel.

Setting Breakpoints from the Simulation Loop Pane

To set a breakpoint at a particular invocation of a method displayed in the Simulation Loop pane, select the check box next to the method's name in the breakpoint column of the pane.

To clear the breakpoint, deselect the check box.

Setting Breakpoints from the MATLAB Command Window

In command-line mode, use the break and bafter commands to set breakpoints before or after a specified method, respectively. Use the clear command to clear breakpoints.


Previous page  Debug Pointer Setting Conditional Breakpoints Next page

© 1994-2005 The MathWorks, Inc.