Main Content


Class: slmetric.Engine
Package: slmetric

Get metric data for one metric for analysis root only


Get metric data from the metric engine where the root of analysis was set using setAnalysisRoot.


metricResult = getAnalysisRootMetric(metric_engine,MetricID) get the metric data from metric_engine, for a specified metric identifier, MetricID, only for the analysis root.

Input Arguments

expand all

When you call execute, metric_engine collects metric data for all available metrics or for the specified MetricID. Calling getMetrics accesses the collected metric data in metric_engine.

Metric identifier for Model Metrics or custom model metrics, that you create. You can get metric identifiers by calling slmetric.metric.getAvailableMetrics.

Example: 'mathworks.metrics.DescriptiveBlockNames'

Output Arguments

expand all

Outputs the object of the slmetric.metric.Result object containing the result data for the requested analysis root and metric.


expand all

This example shows how to set the analysis root, collect, and access the metric data for a metric.

% Create an slmetric.Engine object
metric_engine = slmetric.Engine();

% Specify the model for metric analysis
setAnalysisRoot(metric_engine, 'Root', 'sldemo_fuelsys');

% Collect model metrics for only the analysis root
metricID = 'mathworks.metrics.SimulinkBlockCount';
execute(metric_engine, metricID);

metricResult = getAnalysisRootMetric(metric_engine, metricID);
Introduced in R2017a