Contenuto principale

MATLAB Code Analyzer Findings per Design Layer

R2026b
Since R2026b

Metric ID

mldesignlayer.MATLABCodeAnalyzerFindings

Description

This metric returns the number of issues found by the MATLAB® Code Analyzer for each MATLAB function or method in your project. Use this information to identify MATLAB code that might require fixes, prioritizing by issue severity.

For more information about the MATLAB Code Analyzer, see Check Code for Errors and Warnings Using the Code Analyzer.

Supported Artifacts

This metric collects results for MATLAB design layers in the project, as shown by the metric ID prefix mldesignlayer. A MATLAB design layer is an element, such as a MATLAB function, method, or MATLAB Function block in a Simulink® model, that you implement using MATLAB code. The metric returns one result per design layer.

Collection

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

metric_engine = metric.Engine;
results = execute(metric_engine,"mldesignlayer.MATLABCodeAnalyzerFindings")

View the metric result values and scope for a specific design layer.

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

Results

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

The Value property returns a structure with these fields:

  • Errors — Number of syntax errors or other significant issues

  • SevereErrors — Number of severe errors, such as syntax-level problems that prevent MATLAB from parsing the element correctly. This number is a subset of Errors.

  • Warnings — Number of warning messages

  • Info — Number of informational messages

  • Overall — Total number of Code Analyzer messages, equal to the sum of Errors, Warnings, and Info

The ScopeAlias property returns the name of the function or method that the metric result applies to.

The Artifacts property returns a structure with these fields:

  • UUID — Unique identifier for the MATLAB design layer

  • Name — Name of the function or method

  • ParentUUID — Unique identifier for the parent file or model

  • ParentName — Name of the file or model that contains the design layer

See Also

|

Topics