Collect metric data on models
metric.Engine object represents the metric engine that you
can execute with the
execute object function to collect metric data on your
design. Use the
function to access the metric data and return an array of
generateReport to access a detailed report of metrics
collected. Use design cost metric data to estimate the cost of implementing your design in
embedded C code. For additional metrics, see Model and Code Testing Metrics (Simulink Check).
projectPath — Path of project
character vector | string scalar
Path of project for which to collect metric data, specified as a character vector or string scalar.
ProjectPath — Project for which engine collects metric data
This property is read-only.
Project for which engine collects metric data, returned as a string.
|Delete metric results for model testing artifacts|
|Collect metric data|
|Generate report file that contains metric results|
|Return errors that occurred during metric execution|
|Return issues that occur during artifact analysis|
|Return metric identifiers for available metrics|
|Access metric data for model testing artifacts|
|Open testing artifact traced from metric result|
|Update trace information for pending artifact changes in project|
Collect Metric Data for Each Design Unit in Project
metric.Engine object to collect design cost
metric data on a model reference hierarchy in a project.
To open the project, enter this command.
The project contains
sldemo_mdlref_depgraph, which is the
top-level model in a model reference hierarchy. This model reference hierarchy
represents one design unit.
metric_engine = metric.Engine();
Update the trace information for
metric_engine to reflect
any pending artifact changes.
Create an array of metric identifiers for the metrics you want to collect. For this example, create a list of all available design cost estimation metrics.
metric_Ids = getAvailableMetricIds(metric_engine,... 'App','DesignCostEstimation')
metric_Ids = 1×2 string array "DataSegmentEstimate" "OperatorCount"
To collect results, execute the metric engine.
Because the engine was executed without the argument for
ArtifactScope, the engine collects metrics for the
sldemo_mdlref_depgraph model reference hierarchy.
generateReport function to access detailed metric
results in a pdf report. Name the report
reportLocation = fullfile(pwd,'MetricResultsReport.pdf'); generateReport(metric_engine,... 'App','DesignCostEstimation',... 'Type','pdf',... 'Location',reportLocation);
The report contains a detailed breakdown of the operator count and data segment estimate metric results.
Introduced in R2022a