Main Content

setSeverity

R2026b

Set check severity level

Since R2026b

    Description

    setSeverity(cfgObj,ID,severity) sets the severity of the check specified by ID to severity in the Model Advisor configuration object cfgObj.

    Examples

    collapse all

    Create a Model Advisor configuration object.

    cfgObj = Advisor.Config;

    Load the Model Advisor configuration file myCustomFile.json. Loading the file sets it as the active configuration so that you can access and edit it.

    loadConfig(cfgObj,"myCustomFile.json");

    Set the severity of the check mathworks.jmaab_v6.db_0032 to "Required" in the folder _SYSTEM_By Product_Simulink Check_Modeling Standards_JMAAB v6 Checks. When you set the severity to "Required", a violation of the check results in a failure. By default, the severity is "Advisory", and violations result in a warning. You can obtain the check instance ID and the input parameters in the Model Advisor when you select the check mathworks.jmaab_v6.db_0032. To obtain the instance ID, right-click the check and click Copy.

    setSeverity(cfgObj,"_SYSTEM_By Product_Simulink Check_Modeling Standards_JMAAB v6 Checks_mathworks.jmaab_v6.db_0032","Required");
    

    Verify the updated severity.

    severity = getSeverity(cfgObj,"_SYSTEM_By Product_Simulink Check_Modeling Standards_JMAAB v6 Checks_mathworks.jmaab_v6.db_0032")
    
    severity = 
     'Required'
     

    Input Arguments

    collapse all

    Model Advisor configuration object, specified as an Advisor.Config object.

    Instance ID of the check in Model Advisor, specified as a character vector or string scalar.

    The instance ID of the check represents the location of the check in the configuration file. To obtain the instance ID, right-click the check and click Copy.

    Example: "_SYSTEM_By Product_Simulink Check_Modeling Standards_JMAAB v5.1 Checks_mathworks.maab.db_0140"

    Severity level of the specified check, specified as one of these values:

    • "Required" — A violation of this check is reported as a failure.

    • "Advisory" — A violation of this check is reported as a warning.

    Version History

    Introduced in R2026b