Main Content

Executable Lines of Code Distribution

R2026b
Since R2026b

Metric ID

modeldesign.MATLABMaintainability[slcomp.ELOCDistribution]

Description

This metric returns a histogram showing how many MATLAB® design layers in each unit fall into each executable lines of code (eLOC) range. eLOC counts the lines of code that can be executed, excluding comments and blank lines. Use this metric to identify units that contain large MATLAB design layers that may be difficult to maintain.

Supported Artifacts

This metric collects metric results for Units in the project. To control what the dashboard classifies as a unit, see Categorize Models in Hierarchy as Components or Units.

Collection

To collect data for this metric, execute the metric engine with the metric ID.

metric_engine = metric.Engine;
results = execute(metric_engine,"modeldesign.MATLABMaintainability[slcomp.ELOCDistribution]")

View the metric result values for a specific unit.

results(1).Value
results(1).ScopeAlias

You can also collect all MATLAB maintainability metrics at once by using the group ID.

results = execute(metric_engine,"modeldesign.MATLABMaintainability[]")
Use the MetricID property of each result to identify which metric the result belongs to.

Results

The metric returns an array of metric.Result objects, one for each unit in the project. Use the Value property of the metric result object to view the metric result values. Use the ScopeId and ScopeAlias properties to identify which unit the result belongs to.

The ScopeAlias property returns the name of the unit.

The Value property returns an array of structures representing a histogram. Each structure has these fields:

  • BinEdge — The eLOC range for the bin, such as '0-9'or '>99'

  • BinCount — The number of MATLAB design layers in the unit whose eLOC falls within this range

See Also

Topics