Main Content

openArtifact

Open testing artifact traced from metric result

Since R2022a

Description

openArtifact(metricEngine,artifactID) opens the artifact that has the specified identifier artifactID in the specified metricEngine object. The editor that opens depends on the type of artifact.

  • Simulink® models open in the Simulink Editor.

  • Requirements open in the Requirements Editor.

  • Test cases and test results open in the Test Manager.

example

Examples

collapse all

Use a metric.Engine object to collect design cost metric data on a model reference hierarchy in a project. Then, open one of the top-level model in the Simulink editor.

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 to reflect any pending artifact changes and ensure that all test results are tracked.

updateArtifacts(metric_engine)

To collect results for the metric OperatorCount, execute the metric engine.

execute(metric_engine,{'OperatorCount'});

Use the getMetrics function to access the results.

results = getMetrics(metric_engine,'OperatorCount');
disp(['Unit:  ', results.Artifacts.Name])
disp(['Total Cost:  ', num2str(results.Value)])
Unit:  sldemo_mdlref_depgraph
Total Cost:  57

Open the model artifact in the Simulink Editor by using the artifact identifier.

openArtifact(metric_engine,results(1).Artifacts(1).UUID)

Input Arguments

collapse all

Metric engine object for which metric results are collected, specified as a metric.Engine object.

Artifact identifier, specified as a character vector or string scalar. In a metric.Result object, the Artifacts field contains a structure for each artifact to which the result traces. To get the identifier for an artifact, use the UUID field of the structure for the artifact.

Version History

Introduced in R2022a