Main Content

MATLAB Effective Lines of Code (eLOC)

Since R2022b

Metric ID

slcomp.MATLABeLOC

Description

Use this metric to count the number of effective lines of MATLAB® code. Effective lines of MATLAB code are lines of executable code.

To view the total number of lines of MATLAB code associated with a unit or component, see Overall MATLAB Effective Lines of Code (eLOC).

Supported Artifacts

You can collect this metric for:

To control what the dashboard classifies as a unit or component, see Categorize Models in Hierarchy as Components or Units.

Computation Details

The metric:

  • Only analyzes MATLAB code that does not contain syntax errors.

  • Does not consider the following to be effective lines of code:

    • empty lines

    • lines that contain only comments

    • lines that contain only white spaces

    • lines that contain only an end statement

Collection

To collect data for this metric:

  • In the Model Maintainability Dashboard, in the MATLAB Architecture section, click the Run metrics for widget icon. The distribution of the effective lines of MATLAB code appears in the Lines of Code row and Distribution column. To view a table that shows the effective lines of MATLAB-based code for each model component, click one of the bins in the distribution.

  • Use getMetrics with the metric identifier slcomp.MATLABeLOC.

Results

For this metric, instances of metric.Result return Value as the number of lines of effective MATLAB code in a unit or component.

See Also

Related Topics