Main Content

getClassifications

(To be removed) Obtain metric data classifications

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

example

classifications = getClassifications(threshold) returns the slmetric.config.Classification object or an array of slmetric.config.Classification objects that are in the threshold object.

Examples

collapse all

Add classification information to an slmetric.config.Threshold object. Then, use the getClassifications function to identify the slmetric.config.Classification objects that belong to the threshold object. Use the removeClassification function to remove an classification object from the threshold object.

Create an slmetric.config.Configuration object and get the default slmetric.config.ThresholdConfiguration object.

CONF = slmetric.config.Configuration.new('name', 'Config');
TC = getThresholdConfigurations(CONF);

Create an slmetric.config.Threshold object and add it 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');

Get the default classification object, which defines the compliant category, by using the function getClassifications on the threshold object T. Specify metric values for the compliant category by using the slmetric.metric.MetricRange functions on the range of the classification object.

C = getClassifications(T);
C.Range.Start = 5;
C.Range.IncludeStart = 0;
C.Range.End = 100;
C.Range.IncludeEnd = 0;

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;

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;

Now, the slmetric.config.Threshold object, T, contains three slmetric.config.Classification objects. Each one corresponds to one of the categories compliant, noncompliant, and warning.

P = getClassifications(T)
P = 

  1×3 Classification array with properties:

    Category
    Range

Look at the contents of the Category property.

P.Category
P.Category

ans =

    'Warning'


ans =

    'Compliant'


ans =

    'NonCompliant'

Use the removeClassification function to remove the warning category from the slmetric.config.Threshold object.

removeClassification(T,P(1))

Input Arguments

collapse all

Metric data thresholds, specified as an slmetric.config.Threshold object.

Output Arguments

collapse all

slmetric.config.Classification object or array of slmetric.config.Classification objects that contain metric data classifications.

Version History

Introduced in R2018b

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.