Using Simulink    

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 block or time step that you specified previously. A conditional breakpoint occurs when a condition that you specified in advance arises in the simulation.

Breakpoints come in handy 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.

You set a breakpoint by clicking the breakpoint button on the debugger toolbar

or by selecting the appropriate breakpoint conditions (GUI mode)

or by entering the appropriate breakpoint command (command-line mode).

Command
Causes Simulation to Stop
break <gcb | s:b>
At the beginning of a block
bafter <gcb | s:b>
At the end of a block
tbreak [t]
At a simulation time step
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


  Advancing to the Next Time Step Setting Breakpoints at Blocks