Main Content

Simulink Block Metric

Metric ID

Metric ID: mathworks.metrics.SimulinkBlockCount

Description

Metric Type: Size

Model Advisor Check ID: mathworks.metricchecks.SimulinkBlockCount

Use this metric to calculate the number of blocks in the model. The results provide the number of blocks at the model and subsystem level. This metric counts Simulink®—based blocks, but does not include underlying blocks used to implement the block. This metric is available with Simulink Check™. To collect data for this metric, use getMetrics with the metric identifier, mathworks.metrics.SimulinkBlockCount.

The slmetric.metric.AggregationMode property setting is Sum.

Computation Details

The metric:

  • Runs on library models.

  • Analyzes content in masked subsystems.

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

Collection

To collect data for this metric using the Model Advisor, run the check, Simulink block metric in By Task > Model Metrics > Count Metrics. The Model Advisor check displays the number of blocks in the model or the subsystem. The check does not analyze referenced models or return aggregated results.

Results

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

  • Value: Number of blocks.

  • AggregatedValue: Number of blocks for component and its subcomponents.

  • Measures: Not applicable.

Note

The results from metric analysis of Simulink block metric can differ from calling sldiagnostics. The result of the Simulink block metric:

  • Includes referenced models.

  • Does not include any underlying blocks used to implement a MathWorks® block that you used from the Simulink Library Browser.

  • Does not include links into MathWorks libraries, which means that MathWorks library blocks that are masked subsystems are counted as one block. The inner content of those blocks is not counted.

  • Does not include hidden content under Stateflow® Charts or MATLAB Function blocks.

  • Does not include requirements blocks.

See Also

Related Topics