Single simulation output
Option to return simulation results as single
Simulink.SimulationOutput
object
Model Configuration Pane: Data Import/Export
Description
By default, when you simulate a model, simulation results are returned as a single Simulink.SimulationOutput
object that contains complete simulation
metadata and all simulation data logged to the workspace. Using the single-output format
makes processing results from several simulations easier and provides better support for
parallel and batch simulations. When you return results as a single simulation output,
the syntax to simulate a model programmatically is the same for the
sim
, parsim
, and
batchsim
functions.
Settings
on
(default) | off
on
All simulation data logged to the workspace is returned as a single
Simulink.SimulationOutput
object. By default, the name of the variable that stores theSimulationOutput
object isout
. To use a different variable name, specify a valid MATLAB® variable name in the text box.When you simulate a model programmatically, the name you specify in the text box does not determine the name of the variable that stores the
SimulationOutput
object. TheSimulationOutput
object is stored in the variable to which you assign the return argument. For example, for this simulation, theSimulationOutput
object variable name issimOut
.simOut = sim(simIn);
off
Logged simulation results are returned as one or more variables, depending on the logging options configured in the model.
When you simulate the model using a syntax of the
sim
function that returns multiple output arguments, thesim
function does not return the logging variables. The logging variables are available in the workspace after the simulation completes. Syntaxes of thesim
function that return multiple arguments are not recommended.Simulating a model creates one or more
Simulink.SimulationOutput
objects in any of these situations, even when you disable Single simulation output:You run a set of simulations using the Multiple Simulations pane.
You simulate the model programmatically using one or more
Simulink.SimulationInput
objects.You can configure simulations using
SimulationInput
objects when you run simulations using thesim
,parsim
, andbatchsim
functions.You simulate the model using a
sim
function syntax that returns results as a single simulation output.For more information, see
sim
.
Tips
When you log data using the To File block, the data logs to the specified file and does not appear in the single
Simulink.SimulationOutput
object.When you select Log Dataset data to file, the data that logs to the MAT file is not included in the single
Simulink.SimulationOutput
object.Enabling fast restart enables the Single simulation output parameter.
Use the
who
function for theSimulink.SimulationOutput
object to view a list of the variables in the object.To use the Logging intervals parameter, you must select Single simulation output.
Recommended Settings
The table summarizes recommended values for this parameter based on considerations related to code generation.
Application | Setting |
---|---|
Debugging | No impact |
Traceability | No impact |
Efficiency | No recommendation |
Safety precaution | No recommendation |
Programmatic Use
Parameter: ReturnWorkspaceOutputs |
Value: 'on' | 'off' |
Default: 'on' |
Parameter: ReturnWorkspaceOutputsName |
Type: string | character vector |
Value: valid MATLAB variable name |
Default: 'out' |
Version History
Introduced in R2009b