The debugger provides various commands that let you advance a simulation from the method where it is currently suspended (the next method) by various increments (see Stepping Commands). For example, you can advance the simulation
Into or over the next method
Out of the current method
To the top of the simulation loop.
After each advance, the debugger displays information that enables you to determine the point to which the simulation has advanced and the results of advancing the simulation to that point.
For example, in GUI mode, after each step command, the debugger highlights the current method call stack in the Simulation Loop pane. The call stack comprises the next method and the methods that invoked the next method either directly or indirectly. The debugger highlights the call stack by highlighting the names of the methods that make up the call stack in the Simulation Loop pane.
In command-line mode, you can use the where
command
to display the method call stack.
After executing a block method, the debugger prints any or all of the following block data in the debugger Output panel (in GUI mode) or, if in command line mode, the MATLAB® Command Window:
Un = v
where v
is the current value of the block's n
th
input.
Yn = v
where v
is the current value of the block's n
th
output.
CSTATE = v
where v
is the value of the block's continuous
state vector.
DSTATE = v
where v
is the value of the block's discrete
state vector.
The debugger also displays the current time, the ID and name of the next method to be executed, and the name of the block to which the method applies in the MATLAB Command Window. The following example illustrates typical debugger outputs after a step command.
Command-line mode provides the following commands for advancing a simulation incrementally:
This command... | Advances the simulation... |
---|---|
step [in into] | Into the next method, stopping at the first method in the next method or, if the next method does not contain any methods, at the end of the next method |
step over | To the method that follows the next method, executing all methods invoked directly or indirectly by the next method |
step out | To the end of the current method, executing any remaining methods invoked by the current method |
step top | To the first method of the next time step (i.e., the top of the simulation loop) |
step blockmth | To the next block method to be executed, executing all intervening model- and system-level methods |
next | Same as |
Buttons in the debugger toolbar allow you to access these commands in GUI mode.
Clicking a button has the same effect as entering the corresponding command at the debugger command line.
In GUI mode, the Stop button turns red
when the debugger suspends the simulation for any reason. To continue
the simulation, click the Start/Continue button.
In command-line mode, enter continue
to continue
the simulation. By default, the debugger runs the simulation to the
next breakpoint (see Set Breakpoints) or to the end of the simulation, whichever
comes first.
The run
command lets you run a simulation
to the end of the simulation, skipping any intervening breakpoints.
At the end of the simulation, the debugger returns you to the command
line. To continue debugging a model, you must restart the debugger.
Note
The GUI mode does not provide a graphical version of the run
command.
To run the simulation to the end, you must first clear all breakpoints
and then click the Start/Continue button.