Main Content

slmetric.config.Configuration class

Package: slmetric.config

Specify metric data categories and custom metric families


Instances of slmetric.config.Configuration contain customizations pertaining to thresholds and custom metric families. The metric engine uses these customizations when collecting data and displays them on the Metrics Dashboard.


Use the slmetric.config.Configuration class to add metric threshold values and custom metric families to the Metrics Dashboard. To create an slmetric.config.Configuration object, use the new method. Each slmetric.config.Configuration object contains one slmetric.config.ThresholdConfiguration object.


expand all

Name of configuration object that you use to create Metrics Dashboard customizations. This property is read/write.

Data Types: char

Name of the XML file that contains Metrics Dashboard customizations. This property is read/write.

Data Types: char

Location of the XML file that contains Metrics Dashboard customizations. This property is optional and is read/write.


getMetricFamilyParameterValues Obtain metric family Check Group IDs
getThresholdConfigurations Specify metric threshold configurations
isMetricFamilyParameterParameterized Determine whether Metrics Dashboard configuration object has metric family parameter values
new Create configuration object for customizing the Metrics Dashboard
open Create configuration object associated with XML configuration file in the base workspace
openDefaultConfiguration Return shipping Metrics Dashboard configuration object in base workspace
resetMetricFamilyParameterValues Clear metric family parameter values
saveSave contents of slmetric.config.Configuration object to XML file
setMetricFamilyParameterValues Obtain compliance and issues metric data on your Model Advisor configuration


collapse all

Use the slmetric.config packaged classes to add threshold information to the Metrics Dashboard. You can add thresholds that define metric data ranges for these categories:

  • Compliant — Metric data that is an acceptable range.

  • Warning — Metric data that requires review.

  • Noncompliant — Metric data that requires you to modify your model.

Create an slmetric.config.Configuration object.

CONF ='name', 'Config');

Get the default slmetric.config.ThresholdConfiguration object in CONF.

TC = getThresholdConfigurations(CONF);

Add an slmetric.config.Threshold object to the slmetric.config.ThresholdConfiguration object. This threshold is for the mathworks.metrics.SimulinkBlockCount metric and the Value property of the slmetric.metric.Results object.

T = addThreshold(TC, 'mathworks.metrics.SimulinkBlockCount', 'Value');

An slmetric.config.Threshold object contains a default slmetric.config.Classification object that corresponds to the Compliant category. Use the slmetric.metric.MetricRange class to specify metric values for the Compliant metric range.

C = getClassifications(T); % default classification is Compliant
C.Range.Start = 5;
C.Range.IncludeStart = 0;
C.Range.End = 100;
C.Range.IncludeEnd = 0;

These values specify that a compliant range is a block count from 5 to 100. This range does not include the values 5 and 100.

Specify values for the Warning metric range.

C = addClassification(T,'Warning');
C.Range.Start = -inf;
C.Range.IncludeStart = 0;
C.Range.End = 5;
C.Range.IncludeEnd = 1

These values specify that a warning is a block count between -inf and 5. This range does not include -inf. It does include 5.

Specify values for the NonCompliant metric range.

C = addClassification(T,'NonCompliant');
C.Range.Start = 100;
C.Range.IncludeStart = 1;
C.Range.End = inf;
C.Range.IncludeEnd = 0;

These values specify that a block count greater than 100 is noncompliant. This range includes 100. It does not include inf.

Use the validate method to validate the metric ranges corresponding to the thresholds in the slmetric.config.ThresholdConfiguration object.


If the ranges are not valid, you get an error message. In this example, the ranges are valid.

Save the changes to the configuration file. Use the slmetric.config.setActiveConfiguration function to activate this configuration for the metric engine to use.

configName = 'Config.xml';
save(CONF,'FileName', configName);
slmetric.config.setActiveConfiguration(fullfile(pwd, configName));

You can now run the Metrics Dashboard with this custom configuration on a model.

Version History

Introduced in R2018b