| Using Simulink | ![]() |
Stepping Commands
Command-line mode provides the following commands for advancing a simulation incrementally:
| Command |
Advances the simulation... |
|
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 |
|
Same as step over |
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.
Continuing a Simulation
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 Setting Breakpoints) or to the end of the simulation, whichever comes first.
Animation Mode
In animation mode, the Start/Continue button or the continue command advances the simulation method by method, pausing after each method, to the first method of the next major time step. While running the simulation in animation mode, the debugger uses its debug pointer (see Debug Pointer) to indicate on the block diagram which block method is being executed at each step. The moving pointer providing a visual indication of the progress of the simulation.
| Note When animation mode is enabled, the debugger does not allow you to set breakpoints and ignores any breakpoints that you set when animating the simulation. |
To enable animation when running the debugger in GUI mode, click the Animation Mode toggle button on the debugger's toolbar.
The slider on the debugger toolbar allows you to increase or decrease the delay between method invocations and hence to slow down or speed up the animation rate. To disable animation mode when running the debugger in GUI mode, toggle the Animation Mode button on the toolbar.
To enable animation when running the debugger in command-line mode, enter the animate command at the MATLAB command line. The animate command's optional delay parameter allows you to specify the length of the pause between method invocations (1 second by default) and thereby accelerate or slow down the animation. For example, the command
causes the animation to run at twice its default rate. To disable animation mode when running the debugger in command-line mode, enter
Running a Simulation Nonstop
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 MATLAB 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.
|
| Running a Simulation Step by Step | Debug Pointer | ![]() |
© 1994-2005 The MathWorks, Inc.