Access simulation results
The Simulink.SimulationOutput object includes all logged
simulation data and a SimulationMetadata object that describes simulation
conditions. The Simulink.SimulationOutput object also contains useful
metadata about the simulation, simulation run time. You can use the
Simulink.SimulationOutput object to inspect results of the simulation,
and you can use the plot function on the
Simulink.SimulationOutput object to visualize the results. For simulation
invoked using the Run or Step Forward buttons in
Simulink, the Simulink.SimulationOutput object is stored in the base
workspace, with the name specified in the model parameters.
Simulink.SimulationOutput is writeable.
By default, each simulation you run, creates a
Simulink.SimulationOutput object that contains all data logged in the
simulation, and a Simulink.SimulationMetadata object with the simulation
metadata. You can access the SimulationOutput objects in several ways.
The Simulink.SimulationOutput object returns the logged data for
the simulation.
You can use who, get, and
find methods to access the output variable names and their
respective values.
In the Configuration Parameters, the model setting Single
simulation output, controls whether simulation output is returned in a
Simulink.SimulationOutput object or if data is expanded in the base
workspace. You can also use the command line API for this behavior by setting
ReturnWorkspaceOutputs to on as a name-value argument
pair with the sim command.
| find | Access and display values of simulation results |
| get | Access and display values of simulation results |
| getSimulationMetadata | Return SimulationMetadata object for
simulation |
| setUserData | Store custom data in SimulationMetadata object
that SimulationOutput object contains |
| setUserString | Store custom character vector in SimulationMetadata object in
SimulationOutput object |
| who | Access and display output variable names of simulation |
| plot | Plot simulation output data in the Simulation Data Inspector |