Main Content

Simulink.SimulationData.Parameter

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 user interface (UI) or the Simulink.sdi.exportRun function. For more information about exporting simulation runs with the Simulation Data Inspector UI, see Export Data to Workspace or File.

Creation

Description

example

dataset = Simulink.sdi.exportRun(runID) returns a Simulink.SimulationData.Dataset object, dataset. When the run corresponding to runID contains logged parameter data, the dataset contains a Simulink.SimulationData.Parameter object as an element for each logged parameter. Each Simulink.SimulationData.Parameter element takes the name of the logged parameter. You can access a Simulink.SimulationData.Parameter object using the get function.

Input Arguments

expand all

Run ID for run with logged parameter data, specified as an integer. 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.

Properties

expand all

Name of logged parameter as it appears in Dashboard block label, specified as a character vector.

Example: 'Mu:Gain'

Path of block associated with parameter, specified as a Simulink.SimulationData.BlockPath object.

Example: vdp/Mu

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

Example: 'Gain'

Name of logged variable, specified as a character vector. For parameters, the VariableName property is empty.

Example: 'Zw'

Timeseries of parameter values, specified as a timeseries object. For logged variables, the timeseries object name is the variable name. For logged parameters, the timeseries object name is empty.

Examples

collapse all

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 associated run from the Simulation Data Inspector.

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");

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

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

dataset = Simulink.sdi.exportRun(runID);

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

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

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

Version History

Introduced in R2018a