Using Simulink Previous page   Next Page

Setting Conditional Breakpoints

You can use either the Break on conditions panel of the debugger's Breakpoints pane

or the following commands (in command-line mode) to set conditional breakpoints.

Command
Causes Simulation to Stop
tbreak [t]
At a simulation time step
minor
At methods invoked in minor time steps
nanbreak
At the occurrence of an underflow or overflow (NaN) or infinite (Inf) value
xbreak
When the simulation reaches the state that determines the simulation step size
zcbreak
When a zero crossing occurs between simulation time steps

Setting Breakpoints at Time Steps

To set a breakpoint at a time step, enter a time in the debugger's Break at time field (GUI mode) or enter the time using the tbreak command. This causes the debugger to stop the simulation at the Outputs.Major method of the model at the first time step that follows the specified time. For example, starting vdp in debug mode and entering the commands

causes the debugger to halt the simulation at the vdp.Outputs.Major method of time step 2.078 as indicated by the output of the continue command.

Breaking on Nonfinite Values

Selecting the debugger's NaN values option or entering the nanbreak command causes the simulation to stop when a computed value is infinite or outside the range of values that can be represented by the machine running the simulation. This option is useful for pinpointing computational errors in a Simulink model.

Breaking on Step-Size Limiting Steps

Selecting the Step size limited by state option or entering the xbreak command causes the debugger to stop the simulation when the model uses a variable-step solver and the solver encounters a state that limits the size of the steps that it can take. This command is useful in debugging models that appear to require an excessive number of simulation time steps to solve.

Breaking at Zero Crossings

Selecting the Zero crossings option or entering the zcbreak command causes the simulation to halt when Simulink detects a nonsampled zero crossing in a model that includes blocks where zero crossings can arise. After halting, Simulink displays the location in the model, the time, and the type (rising or falling) of the zero crossing. For example, setting a zero-crossing break at the start of execution of the zeroxing demo model,

and continuing the simulation

results in a rising zero-crossing break at

If a model does not include blocks capable of producing nonsampled zero crossings, the command prints a message advising you of this fact.

Breaking in Minor Time Steps

To break at invocations of a block's methods in minor time steps, select the Minor time steps option on the debugger's Break on conditions panel or enter minor at the debugger command prompt.


Previous page  Setting Breakpoints Displaying Information About the Simulation Next page

© 1994-2005 The MathWorks, Inc.