Simulink.SimulationMetadata
Information about model, environment, execution, and timing of simulation
Description
A Simulink.SimulationMetadata object contains information about
the configuration and environment in which a simulation ran.
The simulation configuration, such as model name and version, simulation start and stop time, and the simulation mode
The environment in which the simulation ran, such as the name of the machine that ran the simulation and the operating system platform on which the simulation ran
Diagnostics issued during simulation
Simulation timing, including a breakdown of the time spent in the initialization, execution, and termination phases
The SimulationMetadata object has properties you can modify to store
additional data and metadata and to save a description of the simulation.
When you run a profiling simulation using the Simulink Profiler,
the Simulink.profiler.Data object that contains the profiling results is returned in
the SimulationMetadata object.
Creation
The software creates a SimulationMetadata object for every simulation you
run that returns results as a single SimulationOutput object. The
SimulationMetadata object is returned in the
SimulationMetadata property of the Simulink.SimulationOutput object that contains the simulation results. To extract
the SimulationMetadata object from a SimulationOutput
object, use dot notation.
simmetadata = out.SimulationMetadata;
To ensure each simulation returns results as a single SimulationOutput
object, use one of these approaches:
Save the model with the Single simulation output enabled.
Enable the Single simulation output parameter for the simulation.
For example, in simulations you run using the
simfunction without aSimulationInputobject, enable theReturnWorkspaceOutputsparameter by specifying a name-value argument or by setting the parameter in the parameter structure orSimulink.ConfigSetinput argument. This code enables the parameter by specifying a name-value argument.out = sim(mdl,ReturnWorkspaceOutputs="on");
The software always returns simulation results as a single output in these situations:
You simulate the model programmatically using one or more
Simulink.SimulationInputobjects.You can configure simulations using
SimulationInputobjects when you run simulations using thesim,parsim, andbatchsimfunctions or using theSimulationobject.You simulate the model using a
simfunction syntax that returns results as a single simulation output.For more information, see
sim.You run a set of simulations using the Multiple Simulations pane.