Main Content

getSimulationMetadata

Access simulation metadata in Simulink.SimulationOutput object

    Description

    simMeta = getSimulationMetadata(simOut) returns the simulation metadata stored in the Simulink.SimulationOutput object simOut. The simulation metadata includes information about the model, simulation execution and timing, and details about errors and warnings that occurred during the simulation.

    You can also get the simulation metadata using a dot to access the value of the SimulationMetadata property.

    simmetadata = out.SimulationMetadata;

    example

    Examples

    collapse all

    The software returns simulation metadata as a Simulink.SimulationMetadata object when you run simulations in a way that returns results as a single Simulink.SimulationOutput object. To access the simulation metadata, you can use dot notation to access the SimulationMetadata property of the SimulationOutput object or use the getSimulationMetadata function.

    Open the model vdp.

    mdl = "vdp";
    openExample("simulink_general/VanDerPolOscillatorExample", ...
        SupportingFile=mdl)

    Simulate the model. The simulation returns results as a single SimulationOutput object because the model vdp has the Single simulation output parameter enabled.

    out = sim(mdl);

    Get the simulation metadata using the getSimulationMetadata function.

    simmeta = getSimulationMetadata(out)
    simmeta = 
    
      SimulationMetadata with properties:
    
            ModelInfo: [1×1 struct]
           TimingInfo: [1×1 struct]
        ExecutionInfo: [1×1 struct]
           UserString: ''
             UserData: []

    Input Arguments

    collapse all

    Simulation results, specified as a Simulink.SimulationOutput object.

    Output Arguments

    collapse all

    Simulation metadata, returned as a Simulink.SimulationMetadata object.

    Version History

    Introduced in R2015a

    expand all