Single simulation output
Option to return simulation results as single
Simulink.SimulationOutput
object
Model Configuration Pane: Data Import/Export
Description
The Single simulation output parameter provides the option to return a
single Simulink.SimulationOutput
object that
contains all simulation results. Using the single-output format makes processing
results from several simulations easier and provides better support for parallel and
batch simulations. When you enable the Single simulation output
parameter, you can use the same code to process results, no matter how you run the
simulation.
Simulating a model creates one or more Simulink.SimulationOutput
objects in any of these situations, even when you disable Single simulation
output:
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 or using theSimulation
object.You simulate the model using a
sim
function syntax that returns results as a single simulation output.For more information, see
sim
.You run a set of simulations using the Multiple Simulations panel.
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 and how you run the simulation.
When you simulate the model using the model name syntax of the
sim
function without specifying any other arguments, the simulation returns only the time vector. To have the simulation return complete results, enable the Single simulation output parameter for the simulation by specifying theReturnWorkspaceOutputs
name-value argument.out = sim(mdl,ReturnWorkspaceOutputs="on");
Syntaxes of the
sim
function that return multiple arguments are not recommended. For more information, see Syntaxes that return multiple output arguments are not recommended.
Examples
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 data to file, the data that logs to the 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.
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