主要内容

本页采用了机器翻译。点击此处可查看英文原文。

getClassifications

(待删除)获取度量数据分类

以后的版本中将会删除度量仪表板用户界面、metricdashboard 函数、slmetric 包 API 以及相应的自定义项。有关详细信息,请参阅从度量盘迁移到模型可维护性仪表盘

说明

classifications = getClassifications(threshold) 返回阈值对象中的 slmetric.config.Classification 对象或 slmetric.config.Classification 对象数组。

示例

示例

全部折叠

slmetric.config.Threshold 对象添加分类信息。然后,使用 getClassifications 函数识别属于阈值对象的 slmetric.config.Classification 对象。使用 removeClassification 函数从阈值对象中移除分类对象。

创建一个 slmetric.config.Configuration 对象,并获取默认的 slmetric.config.ThresholdConfiguration 对象。

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

创建 slmetric.config.Threshold 对象并将其添加到 slmetric.config.ThresholdConfiguration 对象中。此阈值用于 slmetric.metric.Results 对象的 mathworks.metrics.SimulinkBlockCount 度量和 Value 属性。

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

使用阈值对象 T 上的函数 getClassifications 获取定义合规类别的默认分类对象。使用分类对象范围内的 slmetric.metric.MetricRange 函数指定符合类别的度量值。

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

指定 Warning 度量范围的值。

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

指定 NonCompliant 度量范围的值。

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

现在,slmetric.config.Threshold 对象、T 对象包含三个 slmetric.config.Classification 对象。每一项都对应合规、不合规和警告这三个类别之一。

P = getClassifications(T)
P = 

  1×3 Classification array with properties:

    Category
    Range

查看 Category 属性的内容。

P.Category
P.Category

ans =

    'Warning'


ans =

    'Compliant'


ans =

    'NonCompliant'

使用 removeClassification 函数从 slmetric.config.Threshold 对象中删除警告类别。

removeClassification(T,P(1))

输入参数

全部折叠

度量数据阈值,指定为 slmetric.config.Threshold 对象。

输出参量

全部折叠

slmetric.config.Classification 对象或 slmetric.config.Classification 对象数组,其中包含度量数据分类。

版本历史记录

在 R2018b 中推出

全部折叠