主要内容

getThresholdSets

R2026b

Get available threshold sets for project

Since R2026b

    Description

    sets = getThresholdSets(metricEngine) returns an array of threshold set objects representing the threshold sets configured in the current project associated with the metric.Engine object metricEngine. Each threshold set defines the pass/fail criteria (compliance overlays) that the Model Testing, SIL Code Testing, and PIL Code Testing dashboards use to classify metric results.

    In the dashboards, threshold sets appear in the threshold settings in the top-left corner. You can switch between threshold sets to view compliance results under different criteria. Use getThresholdSets to programmatically discover which threshold sets are available — including both the shipping threshold sets (such as "Testing" and "ReqBasedTesting") and any custom threshold sets that have been registered for the project.

    Custom threshold sets are created by copying and modifying a shipping threshold set using metric.config.Configuration. After you register a custom threshold set, it appears alongside the shipping sets in the dashboard UI and in the results returned by getThresholdSets. You can then pass the threshold set ID to getMetrics to retrieve metric results classified according to that specific threshold set.

    example

    Examples

    collapse all

    Create a metric engine for the current project and retrieve the configured threshold sets.

    eng = metric.Engine();
    sets = getThresholdSets(eng)
    sets = 
    
      1×2 ThresholdSet array with properties:
    
        Id
        Name
        Description
        Priority

    Input Arguments

    collapse all

    Metric engine, specified as a metric.Engine object. The engine must be associated with a project that has threshold sets configured.

    Output Arguments

    collapse all

    Threshold sets configured in the project, returned as an array of metric.threshold.ThresholdSet objects. Each object contains the Id, Name, Description, and other properties of the threshold set.

    Version History

    Introduced in R2026b