Main Content

Parameter Metric

Metric ID

Metric ID: mathworks.metrics.ParameterCount

Description

Metric Type: Size

Use this metric to calculate the number of instances of parameter data inside a Simulink® system.

A parameter is a variable used by a Simulink block or object of a basic type (which includes single, double, uint8, uint16, uint32, int8, int16, int32, boolean, logical, struct, char, cell), Simulink.Parameter object, Simulink.VariantExpression object, or enum value. This metric returns every instance of a parameter in a model, which means that the metric counts each instance of a parameter separately. The parameter data must be located in the base workspace, the model workspace, or a data dictionary.

For example, open the model slexAircraftExample by entering this command:

openExample('simulink_aerospace/AircraftLongitudinalFlightControlExample')
The slexAircraftExample model uses two instances of the parameter Zw. One instance is in block slexAircraftExample/Gain at the root level of the model. One instance is in block slexAircraftExample/Aircraft Dynamics Model/Vertical Channel in the Aircraft Dynamics Model subsystem. The metric mathworks.metrics.ParameterCount includes both of these instances of parameter Zw when it calculates the number of parameter instances in the slexAircraftExample model and its subsystems.

This metric is available with Simulink Check™. To collect data for this metric, use getMetrics with the metric identifier, mathworks.metrics.ParameterCount.

The slmetric.metric.AggregationMode property setting is Sum.

Computation Details

This metric:

  • Filters results from the Simulink.findVars function and inherits the limitations of this function.

  • Counts the parameter instances in a component rather than unique parameters.

  • Does not include parameters in masked workspaces.

  • Does not include data type and signal objects.

  • If specified, analyzes the content of library-linked blocks or referenced models.

Results

For this metric, instances of slmetric.metric.Result provide the following results:

  • Value: Number of parameter instances used inside a component.

  • AggregatedValue: Number of parameter instances for a component and its subcomponents.

  • Measures: Not applicable.

See Also

Related Topics