Simulink.SimulationOutput

Access simulation results

Description

The Simulink.SimulationOutput class contains all simulation outputs. The Simulink.SimulationOutput object is writeable. You can use the Simulink.SimulationOutput object to inspect results of the simulation and to visualize the results.

Creation

The Simulink.SimulationOutput is created for each simulation that you run. You can access the SimulationOutput objects in several ways.

  • Simulink.SimulationOutput object returns the data for the xout variable of the Simulink.SimulationOutput.

  • You can use who, get and find methods to access the output variable names and their respective values.

Properties

expand all

Metadata for simulations, returned as a Simulink.SimulationMetadata object. Fields other than the UserData and UserString fields are read only.

Simulation logging error message, returned as a char vector. The ErrorMessage property is read only.

Object Functions

find Access and display values of simulation results
get Access and display values of simulation results
getSimulationMetadataReturn SimulationMetadata object for simulation
setUserDataStore custom data in SimulationMetadata object that SimulationOutput object contains
setUserStringStore custom character vector in SimulationMetadata object in SimulationOutput object
who Access and display output variable names of simulation
plotPlot simulation output data in the Simulation Data Inspector

Examples

collapse all

Simulate a model and place the results of the Simulink.SimulationOutput object in simOut and view the simulation metadata.

Simulate the vdp model.

simOut = sim('vdp','SaveState','on','StateSaveName','xoutNew',...
                     'SaveOutput','on','OutputSaveName','youtNew')
 Simulink.SimulationOutput:

                xoutNew: [65x2 double] 
                youtNew: [65x2 double] 

     SimulationMetadata: [1x1 Simulink.SimulationMetadata] 
           ErrorMessage: [0x0 char] 

Get the values of the variable youtNew.

simOut.youtNew

Simulink® returns and displays the values.

Get the timing information for the simulation.

myMetadata = simOut.SimulationMetadata
myMetadata = 

  SimulationMetadata with properties:

        ModelInfo: [1×1 struct]
       TimingInfo: [1×1 struct]
    ExecutionInfo: [1×1 struct]
       UserString: ''
         UserData: []
myMetadata.TimingInfo
ans = 

  struct with fields:

          WallClockTimestampStart: '2016-12-30 08:47:51.739935'
           WallClockTimestampStop: '2016-12-30 08:47:58.185579'
    InitializationElapsedWallTime: 5.9166
         ExecutionElapsedWallTime: 0.1910
       TerminationElapsedWallTime: 0.3380
             TotalElapsedWallTime: 6.4456
Introduced in R2010a