Main Content

addCheck

Add built-in and published custom checks in configuration

Since R2024b

    Description

    CheckInstanceID = addCheck(CfgObj,ParentFolderID,CheckID) adds the check whose ID is specified in CheckID under the chosen parent folder of the Model Advisor configuration accessed by the CfgObj object. The added check is automatically included in the Model Advisor analysis. If you want to remove the check from the analysis, use the deselect function.

    You can use the addCheck function to add the checks available in the Model Advisor root. The Model Advisor root contains built-in checks for the installed products and published custom checks.

    example

    Examples

    collapse all

    Add the check with the ID mathworks.jmaab.jc_0231 under the root node and mathworks.jmaab.jc_0222 in a new folder myFolder of myCustomFile.json, a configuration file located in your working directory.

    Create a Model Advisor configuration object.

    CfgObj = Advisor.Config;

    Load the myCustomFile.json file.

    loadConfig(CfgObj,'myCustomFile.json');

    Add the checks with ID mathworks.jmaab.jc_0231 under the root node.

    CheckInstanceID = addCheck(CfgObj,'_SYSTEM','mathworks.jmaab.jc_0231')

    The addCheck function returns the instance ID of the added check.

    CheckInstanceID = 
    
        "_SYSTEM_mathworks.jmaab.jc_0231"

    Create a new folder named myFolder under the root node.

    FolderInstanceID = addFolder(CfgObj,'_SYSTEM','myFolder')
    FolderInstanceID =
    
        '_SYSTEM_myFolder'

    Add the check with ID mathworks.jmaab.jc_0222 to the new folder.

    CheckInstanceID1 = addCheck(CfgObj,'_SYSTEM_myFolder','mathworks.jmaab.jc_0222');

    Input Arguments

    collapse all

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

    By default, after creation, the object provides you access to an editable blank configuration that you can use to create a new custom configuration. To customize an existing configuration, load the configuration JSON file as the active configuration by using loadConfig.

    Instance ID of the parent folder, specified as a character vector or string scalar.

    The instance ID of the parent folder represents the location of the folder in the configuration where you want to add checks. The instance ID represents the location of the folder in the form _SYSTEM_Folder Hierarchy. _SYSTEM is the instance ID of the root node.

    For example, the instance ID of the Simulink folder, which is located under the By Product folder in the root node, is _SYSTEM_By Product_Simulink.

    Example: '_SYSTEM_By Product_Simulink'

    Check ID associated with the check, specified as a character vector or string scalar.

    Example: 'mathworks.jmaab.jc_0231'

    Output Arguments

    collapse all

    Instance ID of the added check, returned as a string scalar. The instance ID represents the location of the check in the configuration.

    Example: "mathworks.jmaab.jc_0231"

    Alternative Functionality

    App

    You can also use the Model Advisor Configuration Editor to modify existing configurations and create new configurations. In the Model Advisor Configuration Editor, use the Copy and Paste buttons to add checks from the library to your custom configuration. For more information, see Use Model Advisor Configuration Editor to Customize Model Advisor.

    Version History

    Introduced in R2024b