Main Content

getStatistics

Class: slmetric.Engine
Namespace: slmetric

(To be removed) Get statistics on metric data

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

Generate statistics on the Value properties of the slmetric.metric.Result objects for the specified metric engine object, metric_engine.

example

stats = getStatistics(metric_engine,MetricID) generate statistics for the specified metric identifier.

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

The Statistics object contains the following properties:

  • MinValue is a double that returns the minimum of the Value of the slmetric.metric.Result object.

  • MaxValue is a double that returns the maximum of the Value of the slmetric.metric.Result object.

  • MeanValue is a double that returns the mean of the Value of the slmetric.metric.Result object.

  • StandardDeviation is a double that returns the standard deviation of the Value of the slmetric.metric.Result object.

Examples

expand all

This example shows how to create a slmetric.Engine object, set the analysis root, collect the block count metric, and collect statistics for the model sldemo_fuelsys.

% Open the example model
openExample('sldemo_fuelsys')

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

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

% Generate and collect model metrics
metricID = 'mathworks.metrics.SimulinkBlockCount';
execute(metric_engine, metricID);
stats = getStatistics(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.