Main Content

Advisor.Config

Customize Model Advisor configurations

Since R2024b

Description

Use an Advisor.Config object to create custom Model Advisor configurations.

Creation

Description

cfgObj = Advisor.Config creates a Model Advisor configuration object that provides you access to an editable blank Model Advisor configuration. You can use the object to:

  • Add checks and folders to the blank configuration to create a custom configuration.

  • Load an existing configuration file as the active configuration and customize it.

example

Object Functions

loadConfigLoad existing configuration file for customization
addFolderCreate new folders in configuration
addCheckAdd built-in and published custom checks in configuration
selectInclude check and folder instances in Model Advisor analysis
deselectExclude check and folder instances from Model Advisor analysis
enableEnable check and folder instances in configuration
disableDisable check and folder instances in configuration
deleteDelete check and folder instances from configuration
isSelectedDetermine if check and folder instances are selected in configuration
saveConfigurationSave Model Advisor configuration to JSON file
getConfigFileReturn active Model Advisor configuration filename
createFromCheckListAdd checks in Model Advisor configuration using predefined list of check IDs

Examples

collapse all

This example shows how to use an Advisor.Config object to create a new custom configuration.

Create a Model Advisor configuration object.

CfgObj = Advisor.Config;

The object CfgObj provides you access to an editable blank configuration that you use to create the custom configuration.

Create a new folder named CustomFolder under the root node.

addFolder(CfgObj,'_SYSTEM','CustomFolder');

Add the checks with the IDs mathworks.jmaab.jc_0231 and mathworks.jmaab.jc_0222 under the folder CustomFolder.

addCheck(CfgObj,'_SYSTEM_CustomFolder','mathworks.jmaab.jc_0231');
addCheck(CfgObj,'_SYSTEM_CustomFolder','mathworks.jmaab.jc_0222');

Save the active configuration in a JSON file.

saveConfiguration(CfgObj,'MyCustomConfig.json');

This example shows how to use an Advisor.Config object and its functions to customize an existing configuration, myCustomFile.json, located in your working directory. In this example, you:

  • Add new checks and folders.

  • Select the checks and folders to include in the Model Advisor analysis.

  • Disable the checks and folders to make those unmoveable from the analysis.

Create a Model Advisor configuration object.

CfgObj = Advisor.Config;

Load the myCustomFile.json file.

loadConfig(CfgObj,'myCustomFile.json');

Create a new folder named My Folder under the root node.

addFolder(CfgObj,'_SYSTEM','My Folder');

Add the checks with IDs mathworks.jmaab.jc_0231 and mathworks.jmaab.jc_0222 under My Folder.

addCheck(CfgObj,'_SYSTEM_My Folder','mathworks.jmaab.jc_0231');
addCheck(CfgObj,'_SYSTEM_My Folder','mathworks.jmaab.jc_0222');

Select the folder My Folder and the checks in it.

select(CfgObj,'_SYSTEM_My Folder');

Disable the instance of My Folder and the checks in it.

disable(CfgObj,'_SYSTEM_My Folder');

Save the customized configuration to the original JSON file myCustomFile.json

saveConfiguration(CfgObj,'myCustomFile.json');

Version History

Introduced in R2024b