Main Content

Effective Lines of MATLAB Code Metric

Metric ID

Metric ID: mathworks.metrics.MatlabLOCCount

Description

Metric Type: Size

Model Advisor Check ID: mathworks.metricchecks.MatlabLOCCount

Run this metric to calculate the number of effective lines of MATLAB® code. Effective lines of MATLAB code are lines of executable code. Empty lines, lines that contain only comments, and lines that contain only an end statement are not considered effective lines of code. The results provide the number of effective lines of MATLAB code for each MATLAB Function block and for MATLAB functions in Stateflow® charts.

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

The slmetric.metric.AggregationMode property setting is Sum.

Computation Details

The metric:

  • Runs on library models.

  • Analyzes content in masked subsystems.

  • Does not analyze the content of MATLAB code in external files.

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

Collection

To collect results for this metric using the Model Advisor, run the check, Effective lines of MATLAB code metric in By Task > Model Metrics > Count Metrics. The Model Advisor check displays the number of effective lines of MATLAB code for each MATLAB Function block and for MATLAB functions in Stateflow charts in the model. 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 effective lines of MATLAB code.

  • AggregatedValue: Number of effective lines of MATLAB code for a component and its subcomponents.

  • Measures: Not applicable.

See Also

Related Topics