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.SimulationData.Parameter class

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.

Copy Semantics

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

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')
ans = 
  Simulink.SimulationOutput:

                logsout: [1x1 Simulink.SimulationData.Dataset] 

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

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