There is no command-line interface for Simulation Stepper.
Simulation stepping (forward and backward) is available only for Normal and Accelerator modes.
The step back capability relies on SimState technology for saving and restoring the state of a simulation. As a result, the step back capability is available only for models that support SimState. For more information, see Save and Restore Simulation Operating Point.
Simulation Stepper steps through the major time steps of a simulation without changing the course of a simulation. Choosing a refine factor greater than unity produces loggable outputs at times between the major time steps of the solver. These times are not major time steps, and you cannot step to a model state at those times.
If you run a simulation with stepping back enabled, the Simulink® software checks whether the model can step back. If it cannot, a warning appears at the MATLAB® command prompt. For some simulations, Simulink cannot step back. The step back capability is then disabled until the end of that simulation. Then the setting resets to the value you requested.
When you place custom code in Configuration Parameters > Simulation Target > Custom Code > Initialize function in the Model Configuration Parameters dialog box, this gets called only during the first simulation in Simulation Stepper.
Some blocks do not support stepping back for reasons other than SimState support. These blocks are:
S-functions that have P-work vectors but do not declare their SimState compliance level or declare it to be unknown or disallowed (see S-Function Compliance with the ModelOperatingPoint)
Simscape™ Multibody™ First Generation blocks
Legacy (pre-R2016a) SimEvents® blocks
MATLAB Function blocks generally support stepping back. However, the use of certain constructs in the MATLAB code of these blocks can prevent the block from supporting stepping back. These scenarios prevent the MATLAB Function blocks from stepping back:
Persistent variables of opaque data type. Attempts to step back under this condition cause an error message based on the specific variable type.
Extrinsic functions calls that can contain state (such as properties of objects or persistent data of functions). No warnings or error messages appear, but the result likely will be incorrect.
Calls to custom C code (through MEX function calls) that do not contain static variables. No warnings or error messages appear, but the result likely will be incorrect.
Some visualization blocks do not support stepping back. Because these blocks are not critical to the state of the simulation, no errors or warnings appear when you step back in a model that contains these blocks:
Averaging Spectrum Analyzer
Power Spectral Density
Averaging Power Spectral Density
Floating Bar Plot
Any blocks that implement custom visualization in their output
method (for example, an S-function that outputs to a MATLAB figure) are not fully supported for stepping back
because the block method
Output does not
execute while stepping back. While the state of such blocks
remains consistent with the simulation time (if the blocks
comply with SimState), the visualization component is
inconsistent until the next step forward in the
Because these blocks do not affect the numerical result of a simulation, stepping back is not disabled for these blocks. However, the values these blocks output are inaccurate until the simulation steps forward again.