主要内容

Compile Diagnostics

R2026b
Since R2026b

Metric ID

slcomp.CompileDiagnostics

Description

This metric returns the number of compile errors and warnings from the most recent model compilation for each unit in your project. Use this metric to identify units that have compilation issues. The metric also reports when the unit was last compiled.

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,"slcomp.CompileDiagnostics")

View the metric result values for a specific unit.

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

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 missing when the unit has not been compiled. When compile results exist, the Value property returns a structure with these fields:

  • Errors — Number of compile-time errors

  • Warnings — Number of compile-time warnings

  • LastCompile — Time of the most recent compilation, in milliseconds. To convert to a readable date, use datetime(result.LastCompile/1000,'ConvertFrom','posixtime').

See Also

Topics