Main Content

getAnalysisRootMetric

Class: slmetric.Engine
Namespace: slmetric

(To be removed) Get metric data for one metric for analysis root only

The Metrics Dashboard user interface, metricdashboard function, slmetric package API, and corresponding customizations will be removed in a future release. For more information, see Migrating from Metrics Dashboard to Model Maintainability Dashboard.

Description

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

example

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.

Examples

expand all

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

% Open the example model
openExample('sldemo_fuelsys')

% 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);

Version History

Introduced in R2017a

collapse all

R2022a: Metrics Dashboard will be removed

The Metrics Dashboard user interface, metricdashboard function, slmetric package API, and corresponding customizations will be removed in a future release. For more information, see Migrating from Metrics Dashboard to Model Maintainability Dashboard.