Main Content

metric.config.Configuration.copyThresholdSet

R2026b

Copy thresholds from shipping threshold set into new configuration

Since R2026b

    Description

    config = metric.config.Configuration.copyThresholdSet(SourceThresholdSetId=SourceId,TargetThresholdSetId=TargetId) copies all thresholds from the shipping threshold set identified by SourceId into a new configuration with a threshold set identified by TargetId. The testing dashboards display compliance overlays based on shipping thresholds. If the shipping thresholds do not match your project criteria, use this method to create a custom configuration from an existing shipping threshold set as a starting point, as shown in Adjust Dashboard Thresholds to Match Your Testing Criteria.

    Example of custom threshold set in threshold settings for a dashboard

    example

    config = metric.config.Configuration.copyThresholdSet(SourceThresholdSetId=SourceId,TargetThresholdSetId=TargetId,MetricIds=MetricIds) copies only the thresholds for the specified metric identifiers from the source threshold set.

    example

    Examples

    collapse all

    Copy the requirements-based testing shipping threshold set into a new custom threshold set that you can modify.

    Copy all threshold rules from "ReqBasedTesting" into a new threshold set.

    config = metric.config.Configuration.copyThresholdSet( ...
        SourceThresholdSetId="ReqBasedTesting", ...
        TargetThresholdSetId="MyTestingThresholds")
    config =
    
      Configuration with properties:
    
                             FileName: []
                                 Name: ''
                        ThresholdSets: [1x1 metric.threshold.ThresholdSet]
                              Metrics: [0x0 metric.config.MetricDefinition]
                         TableMetrics: [0x0 metric.config.TableMetricDefinition]
        MetricDefinitionSchemaVersion: "0.3.0"
                       ThresholdRules: [1x32 metric.threshold.ThresholdRule]
               ThresholdSchemaVersion: "0.2.0"

    Set a display name for the custom threshold set. This name appears in the threshold settings in the dashboard.

    config.ThresholdSets.Name = "My Customized Thresholds";
    config.ThresholdSets.Description = "Custom compliance criteria for my project";

    Copy threshold rules for only specific metrics from a shipping threshold set.

    Copy only the threshold rules for test result analysis and coverage ratio metrics.

    config = metric.config.Configuration.copyThresholdSet( ...
        SourceThresholdSetId="ReqBasedTesting", ...
        TargetThresholdSetId="MyTestingThresholds", ...
        MetricIds=["modeltesting.RequirementsBasedCoverage[slcomp.CoverageRatio]", ...
                   "modeltesting.TestResultAnalysis[slcomp.TestStatusDistribution]"])
    config =
    
      Configuration with properties:
    
                             FileName: []
                                 Name: ''
                        ThresholdSets: [1x1 metric.threshold.ThresholdSet]
                              Metrics: [0x0 metric.config.MetricDefinition]
                         TableMetrics: [0x0 metric.config.TableMetricDefinition]
        MetricDefinitionSchemaVersion: "0.3.0"
                       ThresholdRules: [1x10 metric.threshold.ThresholdRule]
               ThresholdSchemaVersion: "0.2.0"

    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: metric.config.Configuration.copyThresholdSet(SourceThresholdSetId="ReqBasedTesting",TargetThresholdSetId="MyTestingThresholds")

    Example: ["modeltesting.RequirementsBasedCoverage[slcomp.CoverageRatio]", "modeltesting.TestResultAnalysis[slcomp.TestStatusDistribution]"]

    Identifier of the shipping threshold set to copy from, specified as a string scalar. Shipping threshold sets include "Testing" and "ReqBasedTesting".

    Data Types: string

    Identifier for the new threshold set in the returned configuration, specified as a string scalar.

    Data Types: string

    Metric identifiers to copy from the source threshold set, specified as a string array. When you do not specify this argument or specify an empty array, the function copies all thresholds from the source set.

    Data Types: string

    Output Arguments

    collapse all

    Configuration, returned as a metric.config.Configuration object containing the copied threshold set.

    Version History

    Introduced in R2026b