Hauptinhalt

getArtifactErrors

R2026b

Return errors that occurred during metric execution

Since R2022a

Description

errors = getArtifactErrors(metricEngine) returns the errors that occur when the metricEngine analyzes the Simulink® models. The metricEngine object does not collect results for artifacts that return errors during analysis.

example

Examples

collapse all

Collect design cost metrics for artifacts in a project. Then, check if artifacts returned errors and were not analyzed.

To open the project, enter this command.

openExample('simulink/VisualizeModelReferenceHierarchiesExample')

Create a metric.Engine object.

metric_engine = metric.Engine();

Update the trace information for metric_engine so that the artifact information is up to date.

updateArtifacts(metric_engine)

Collect results for the design cost metrics by using the execute function on the metric.Engine object.

execute(metric_engine,["DataSegmentEstimate","OperatorCount"]);

Access the errors that occurred during analysis.

getArtifactErrors(metric_engine)
ans =

  0×0 empty struct array with fields:

    URI
    ErrorId
    ErrorMessage
    Severity

For this example, the artifacts did not return errors.

Input Arguments

collapse all

Metric engine object to check for errors, specified as a metric.Engine object.

Output Arguments

collapse all

Artifact errors that occur when you execute the metric.Engine object, returned as an array of structures that correspond to the errors. The structure for an error contains these fields:

  • URI — Digital thread URI of the artifact that returned the error

  • ErrorId — Identifier of the error

  • ErrorMessage — Description of the error

  • Severity — Severity of the error

Version History

Introduced in R2022a