Using Simulink | ![]() ![]() |
Setting Breakpoints at Time Steps
To set a breakpoint at a time step, enter a time in the debugger's Stop at time field (GUI mode) or enter the time, using the tbreak
command. The debugger to stop the simulation at the beginning of the first time step that follows the specified time. For example, starting vdp
in debug mode and entering the commands
tbreak 9 continue
causes the debugger to halt the simulation at the beginning of time step 9.0785
as indicated by the output of the continue
command.
[Tm=9.07847133212036 ] **Start** of system 'vdp' outputs
Breaking on Nonfinite Values
Checking 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
Checking 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
Checking the Zero crossings option or entering the zcbreak
command causes the simulation to halt when Simulink detects a non-sampled zero crossing in a model that includes blocks where zero-crossings can arise. After halting, Simulink prints 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
sldebug zeroxing [Tm=0 ] **Start** of system 'zeroxing' outputs (sldebug @0:0 'zeroxing/Sine Wave'): zcbreak Break at zero crossing events is enabled.
(sldebug @0:0 'zeroxing/Sine Wave'): continue
results in a rising zero-crossing break at
[Tm=0.34350110879329 ] Breaking at block 0:2 [Tm=0.34350110879329 ] Rising zero crossing on 3rd zcsignal in block 0:2 'zeroxing/Saturation'
If a model does not include blocks capable of producing nonsampled zero-crossings, the command prints a message advising you of this fact.
![]() | Setting Breakpoints at Blocks | Displaying Information About the Simulation | ![]() |