Main Content

terminate

Terminate simulation represented by Simulation object

Since R2024a

    Description

    simout = terminate(s) terminates the simulation represented by the Simulation object s and returns the simulation results simout as a Simulink.SimulationOutput object.

    Use the terminate function to terminate simulations that have fast restart enabled.

    After a simulation terminates, the next simulation you run for the same model must compile the model and initialize the simulation. Fast restart saves time in iterative simulations of the same model by skipping termination, compilation, and initialization. To ensure the accuracy of simulation results, the software allows modifications to a model that is initialized in fast restart only when the modifications do not require compiling the model. For more information, see Get Started with Fast Restart.

    Stopping a simulation using the terminate function always terminates the simulation. When you use the terminate function to stop a simulation, the simulation status changes to stopping, then terminating, and then inactive.

    To stop a fast restart simulation without terminating the simulation, use the stop function. Stopping a simulation using the stop function terminates the simulation only when fast restart is not enabled.

    • When you use the stop function to stop a simulation that has fast restart enabled, the simulation status changes to stopping, then restarting, and then initialized.

    • When you use the stop function to stop a simulation that does not have fast restart enabled, the simulation status changes to stopping, then terminating, and then inactive.

    Input Arguments

    collapse all

    Simulation to terminate, specified as a Simulation object.

    Output Arguments

    collapse all

    Simulation results and metadata, returned as a Simulink.SimulationOutput object.

    Version History

    Introduced in R2024a