This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Simulink.SimulationOutput class

Package: Simulink

Access object values of simulation results


The SimulationOutput class contains all simulation outputs, including workspace variables.

You can use dot notation to access the data for simulation outputs. For example, to return data for the xout variable for a simOut SimulationOutput object, use a simOut.tout command.

Alternatively, you can use Simulink.SimulationOutput.who and either Simulink.SimulationOutput.get or Simulink.SimulationOutput.find methods to access the output variable names and their respective values.


expand all

Metadata for simulation runs, 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. (read only)


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 that SimulationOutput object contains
who Access and display output variable names of simulation

Copy Semantics

Value. To learn how value classes affect copy operations, see Copying Objects (MATLAB) in the MATLAB® Programming Fundamentals documentation.


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','SimulationMode','normal','AbsTol','1e-5',...

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

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

Get the values of the variable 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: []
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