Main Content

Simulation Stepping Options

Enable stepping back and configure number of time steps to move when stepping through simulation

Description

Use the Simulation Stepping Options dialog box to configure how many major time steps the simulation moves when you click Step Forward or Step Back and to enable stepping back. You can step backward in time in a simulation only after you enable stepping back using the Simulation Stepping Options.

You can adjust the simulation stepping options during simulation to balance simulation performance against the granularity of steps based on the runtime behavior of the system. For more information, see How Stepping Through Simulations Works.

Rapid accelerator simulations do not support stepping forward or backward. To step through a simulation, use normal or accelerator mode. When you want to use low-level debugging capabilities, such as stepping block by block, use normal mode.

For an example that shows all the options available for stepping through simulations, see Step Through Simulations Using the Simulink Editor. The table summarizes when and how you can use buttons in the Simulink® Toolstrip to control the simulation execution.

Stepping OptionDescriptionKeyboard ShortcutAvailability

Continue

Continue simulation.

Ctrl+T or F5

On macOS, press command (⌘) instead of Ctrl.

Always available.

Step Forward

Advance the simulation by one or more time steps.

Step Back

Step simulation back by one or more time steps.

To use this option, you must enable stepping back. For more information, see Simulation Stepping Options.

Available only when you enable stepping back using the Simulation Stepping Options dialog box.

Step Over

Advance simulation to just before the next block executes.

F10 (since R2023b)

On macOS, press Shift+Command+O.

Available before starting a simulation and when a simulation is paused if Pause within time step is enabled in the Breakpoints List. (since R2024b)

In R2024a: Available while simulation is paused if Pause within time step is enabled and the model has at least one active breakpoint.

Before R2024a: Available only while paused within a time step.

Step In

Step into Model block, atomic subsystem, MATLAB Function block, or Stateflow® chart.

When the next block to execute is not a Model block, atomic subsystem, or MATLAB Function block and the simulation is not paused on a Stateflow chart, the Step In button takes the same action as the Step Over button.

F11 (since R2023b)

On macOS, press Shift+Command+I.

Available only when paused within a time step.

Step Out

Steps out of Model block, atomic subsystem, or Stateflow chart.

When the next block to execute is not a Model block or atomic subsystem and the simulation is not paused on a Stateflow chart, the Step In button takes the same action as the Step Over button.

Shift+F11 (since R2023b)

On macOS, press Shift+Command+U.

Simulation Stepping Options dialog box

Open the Simulation Stepping Options

  • Simulink Toolstrip: On the Simulation tab or the Debug tab, click the Step Back button.

  • Simulink Toolstrip: On the Simulation tab or the Debug tab, click the Step Back button arrow and select Configure Simulation Stepping.

Parameters

expand all

Select this option to enable stepping backward as well as forward in time during simulation. When you select this option, you can configure how the software saves data during simulation to support stepping back.

Specify how many simulation snapshots to save to support stepping back. A simulation snapshot contains all the information required to restore the state of the simulation.

Simulation snapshots are stored in memory and are not accessible in the workspace during or after simulation. Saving more snapshots increases the amount of memory the simulation uses and can slow the speed of the simulation.

Dependencies

To enable this parameter, select Enable stepping back.

Specify the number of major time steps between each simulation snapshot the software saves to support stepping back.

Dependencies

To enable this parameter, select Enable stepping back.

Specify the number of major time steps to step through each time you press the Step Forward or Step Back button.

Tips

  • To inspect signal values while stepping through the simulation, display port value labels on signals. Select a signal. Then, on the Debug tab, under Tools, in the Output Values button group, click Show Output Value of selected signal .

  • To start stepping through a normal or accelerator mode simulation that is already running, pause the simulation. Then, use the Step Forward and Step Backward buttons.

  • To start stepping from a specific time within a simulation, specify a pause time. On the Debug tab, under Breakpoints, specify the Pause Time in seconds. When you start the simulation by clicking Run, the simulation runs until the specified time and pauses. From there, you can step through the simulation.

  • To debug the behavior of a model around a point of interest, you can add a signal breakpoint and specify the condition such that the simulation pauses at the time of interest. Then, use the Step Forward and Step Backward buttons. For more information about setting breakpoints in your model, see Breakpoints List.

  • The stepping and breakpoint options in the Simulink Editor do not have a direct programmatic equivalent available in the software. The Simulink debugging programmatic interface includes options for setting breakpoints and stepping through simulations. However, the behavior of these functions is not identical to the behavior of the stepping options in the Simulink Editor. For more information about programmatic debugging, see Simulink Debugging Programmatic Interface.

Version History

Introduced in R2012b

expand all