Using Simulink Previous page   Next Page

Running a Simulation Step by Step

The Simulink 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, or out of the current method, or 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. If the next method is a block method, the debugger points the debug pointer at the block corresponding to the method (see Debug Pointer for more information). If the block of the next method to be executed resides in a subsystem, the debugger opens the subsystem and points to the block in the subsystem's block diagram.

Block Data Output

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 in the MATLAB Command Window (in command-line mode):

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.


Previous page  Starting a Simulation Stepping Commands Next page

© 1994-2005 The MathWorks, Inc.