主要内容

removeThresholdRule

R2026b

Remove threshold rule from configuration

Since R2026b

    Description

    removeThresholdRule(config,Name=Value) removes the threshold rule matching the specified identifiers from the configuration config. Remove a threshold rule when you want the corresponding dashboard widget to no longer show a compliance overlay, as shown in Adjust Dashboard Thresholds to Match Your Testing Criteria.

    Threshold rules for the "Not Run" widget

    example

    Examples

    collapse all

    Remove a threshold rule from a custom threshold set so that the corresponding widget no longer shows a compliance overlay in the dashboard.

    Copy the shipping threshold set and verify the number of threshold rules.

    config = metric.config.Configuration.copyThresholdSet( ...
        SourceThresholdSetId="ReqBasedTesting", ...
        TargetThresholdSetId="MyTestingThresholds");
    numel(config.ThresholdRules)
    ans =
    
        32

    Remove the "NotRun" threshold rule. After removal, the Not Run widget no longer shows a compliance overlay in the dashboard.

    removeThresholdRule(config, ...
        ThresholdSetId="MyTestingThresholds", ...
        MetricId="modeltesting.TestResultAnalysis[slcomp.TestStatusDistribution]", ...
        ThresholdRuleId="NotRun");
    numel(config.ThresholdRules)
    ans =
    
        31

    Save and register the configuration to apply the change in the dashboard.

    proj = currentProject;
    p = proj.RootFolder;
    config.FileName = fullfile(p,"MyConfig.json");
    saveAndRegister(config,ResourcesLocation=p)

    Input Arguments

    collapse all

    Configuration, specified as a metric.config.Configuration object.

    Name-Value Arguments

    collapse all

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: removeThresholdRule(config,ThresholdSetId="MyTestingThresholds",MetricId="modeltesting.TestResultAnalysis[slcomp.TestStatusDistribution]",ThresholdRuleId="NotRun")

    Identifier of the threshold set containing the rule to remove, specified as a string scalar.

    Data Types: string

    Identifier of the metric associated with the threshold rule to remove, specified as a string scalar.

    Data Types: string

    Unique identifier of the threshold rule to remove, specified as a string scalar.

    Data Types: string

    Version History

    Introduced in R2026b