Using Simulink | ![]() ![]() |
Advancing to the Next Block
To advance a simulation one block, click on the debugger toolbar or, if the debugger is running in command-line mode, enter
step
at the debugger prompt. The debugger executes the current block, stops, and highlights the next block in the model's block execution order (see Displaying a Model's Block Execution Order). For example, the following figure shows the vdp
block diagram after execution of the model's first block.
If the next block to be executed occurs in a subsystem block, the debugger opens the subsystem's block diagram and highlights the next block.
After executing a block, the debugger prints the block's inputs (U
) and outputs (Y
) and redisplays the debug command prompt in the debugger output panel (in GUI mode) or in the MATLAB command window (in command-line mode).
The debugger prompt shows the next block to be evaluated.
Crossing a Time Step Boundary
After executing the last block in the model's block execution list, the debugger advances the simulation to the next time step and halts the simulation. To signal that you have crossed a time step boundary, the debugger prints the current time in the debugger output panel in GUI mode or in the MATLAB command window in command-line mode. For example, stepping through the last block of the first time step of the vdp
model results in the following output in the debugger output panel or the MATLAB command window.
(sldebug @0:8 'vdp/Sum'): step U1 = [2] U2 = [0] Y1 = [-2] [Tm=0.0001004754572603832 ] **Start** of system 'vdp' outputs
Stepping by Minor Time Steps
You can step by blocks within minor time steps as well as within major steps. To step by blocks within 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.
![]() | Running a Simulation | Advancing to the Next Time Step | ![]() |