Main Content

deleteMetrics

Delete metric results for model testing artifacts

Since R2022a

Description

example

deleteMetrics(metricEngine,metricIDs) deletes the metric results specified by metricIDs for the specified metricEngine object. To collect metric results for the metricEngine object, use the execute function. To access the results, use the generateReport function.

deleteMetrics(metricEngine,metricIDs,'ArtifactScope',scope) deletes the metric results for the artifacts in the specified scope. For example, you can specify scope to be a single design unit in your project, such as a Simulink® model or an entire model reference hierarchy.

Examples

collapse all

To open the project, enter this command.

openExample('simulink/VisualizeModelReferenceHierarchiesExample')

Create a metric.Engine object.

metric_engine = metric.Engine();

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

execute(metric_engine,{'OperatorCount'});

Delete the metric results.

deleteMetrics(metric_engine,'OperatorCount')

Input Arguments

collapse all

Metric engine object for which to delete metric results, specified as a metric.Engine object.

Metric identifiers for metrics that you want to delete, specified as a character vector or cell array of character vectors. For a list of design cost metrics, see Design Cost Model Metrics. For a list of model testing metrics and their identifiers, see Model Testing Metrics (Simulink Check).

Example: 'DataSegmentEstimate'

Example: {'DataSegmentEstimate', 'Operator Count'}

Path and identifier of project file for which to delete metric results, specified as a cell array of character vectors. The first element of the array is the full path to a project file. The second element is the identifier of the object inside the project file.

For a unit model, the first element is the full path to the model file. The second element is the name of the block diagram. When you use this argument, the metric engine deletes the results for the artifacts that trace to specified project file.

Example: {'C:\work\MyModel.slx', 'MyModel'}

Tips

  • If design changes are not reflected in the design cost metric results, first use the deleteMetrics function to delete the metric.Result, then use the execute function to collect metrics.

  • Report generation using the generateReport function requires that the metric collection be executed in the current session. To recollect design cost metrics, first use the deleteMetrics function to delete the metric.Result, then use the execute function to collect metrics.

Version History

Introduced in R2022a