Simulink.SimulationData.Parameter class

Package: Simulink.SimulationData

Stores logged parameter data and metadata

Description

The Simulink.SimulationData.Parameter object stores data and metadata for logged block parameters. Tunable parameters connected to Dashboard blocks are logged to the Simulation Data Inspector during simulation. To access logged parameter data, you can export the simulation run from the Simulation Data Inspector using the UI or the Simulink.sdi.exportRun function. For more information about exporting simulation runs with the Simulation Data Inspector UI, see Export Data from the Simulation Data Inspector.

Construction

dataset = Simulink.sdi.exportRun(runID) returns a Simulink.SimulationData.Parameter object as an element in dataset when the run corresponding to runID contains logged parameter data.

Input Arguments

expand all

Run ID for the run containing logged parameter data. Run IDs are assigned by the Simulation Data Inspector. You can get the run ID for a simulation run using the Simulink.sdi.getAllRunIDs or Simulink.sdi.getRunIDByIndex function.

Output Arguments

expand all

Simulink.SimulationData.Dataset object containing the run data and metadata. When the run contains logged parameter data, the dataset contains a Simulink.SimulationData.Parameter object as an element for each logged parameter. The Simulink.SimulationData.Parameter element takes the name of the logged parameter. You can access a Simulink.SimulationData.Parameter object using get.

Properties

expand all

Parameter name as it appears in the label for the Dashboard block.

Example: 'Mu:Gain'

Path to the block the parameter or variable corresponds to, returned as a Simulink.SimulationData.BlockPath object.

Example: vdp/Mu

Name of the logged parameter as it appears in the block dialog box. For variables, the ParameterName property is empty.

Example: 'Gain'

Name of the logged variable. For parameters, the VariableName property is empty.

Example: 'Zw'

timeseries of parameter values. For logged variables, the timeseries name is the variable name. For logged parameters, the timeseries name is empty.

Methods

plotPlot simulation output data in the Simulation Data Inspector

Copy Semantics

Value. To learn how value classes affect copy operations, see Copying Objects.

Examples

collapse all

This example shows how to access logged parameter data. Parameter data automatically logs to the Simulation Data Inspector when you connect a Dashboard block to a block parameter. Parameter data does not export to the workspace with other simulation data at the end of simulation. You can access the logged parameter data by exporting the run containing it from the Simulation Data Inspector.

Log Parameter Data

Run a simulation of the model ex_vdp_param, a modified version of the vdp model with an Edit block connected to the gain parameter of the Mu block. The parameter data logs with the signal data for signals marked for logging.

sim('ex_vdp_param');

Export Run

Use the Simulation Data Inspector programmatic interface to get the run ID for the ex_vdp_param simulation, and export the run.

index = Simulink.sdi.getRunCount;
runID = Simulink.sdi.getRunIDByIndex(index);

dataset = Simulink.sdi.exportRun(runID);

Access Parameter Data

Use the get method to access the Simulink.SimulationData.Parameter object for the logged parameter data. The Values property contains the timeseries data for the parameter.

muGain = dataset.get('Mu:Gain')
muGain = 
  Simulink.SimulationData.Parameter
  Package: Simulink.SimulationData

  Properties:
         Name: 'Mu:Gain'
    BlockPath: [1x1 Simulink.SimulationData.BlockPath]
       Values: [1x1 timeseries]


  Methods, Superclasses
Introduced in R2018a