Load and Associate a Custom Configuration with a Model
Custom configurations allow you to specify which checks run during Model Advisor analysis. When you load a custom configuration, the Model Advisor uses the folders and checks specified by the configuration. You can also associate a custom configuration with your model so that the Model Advisor uses that configuration each time you open that model.
For example, to create a custom configuration and associate the configuration with
Set your current folder to a writeable directory.
Create and save a new model called
newModel. In the MATLAB® Command Window, enter:
Open the Model Advisor by entering:
In the Model Advisor, click Open > Open Configuration Editor to open the Model Advisor Configuration Editor.
You can use the Model Advisor Configuration Editor to specify the folders and checks that you want to include in the Model Advisor. For information on how to create a custom configuration, see Use Model Advisor Configuration Editor to Customize Model Advisor.
In the Model Advisor Configuration Editor, click Save As to save a new, custom configuration file. For this example, save the configuration file as
customConfig.json. The Model Advisor Configuration Editor prompts you to save the configuration as the default configuration. For this example, click No.
Update your Simulink® environment to include the custom configuration file. At the MATLAB command line, enter:
For more information, see Update the Environment to Include Your Custom Configuration.
Re-open the Model Advisor for the model
newModel. In the MATLAB Command Window, enter:
In the Model Advisor, click Open > Load Configuration and select the custom configuration file
customConfig.jsonto load the configuration file into the Model Advisor.
If the configuration file that you loaded contains checks that are incompatible with the newer version of MATLAB you use, you get a dialog box asking whether to automatically fix issues in the configuration. To fix the issues automatically, click Yes, and then perform the steps as described in Update or Delete Checks in Configuration Files Automatically Using Model Advisor.
In the Model Advisor Check Selector pane, you can verify that you see the folders and checks specified in the custom configuration. If you expect a folder or check to appear in the Model Advisor and it does not, see Use Model Advisor Configuration Editor to Customize Model Advisor and Update the Environment to Include Your Custom Configuration.
If you want the Model Advisor to use this configuration each time you open the model
newModel, associate the loaded configuration file with the model by using one of these approaches:
In the Model Advisor, click Open > Associate Configuration to Model. The Model Advisor opens the Configuration Parameters dialog box for the model. The Model Advisor configuration file parameter lists the configuration file associated with the model. Click OK.
In the MATLAB Command Window, provide the model name and configuration file name as inputs to the function
You can view the Model Advisor configuration file associated with the model by entering:
To return to your default configuration, click Open > Restore Default Configuration.
For information on how to restore the default shipping configuration or set a new default configuration, see Use Model Advisor Configuration Editor to Customize Model Advisor.
The Model Advisor looks for configuration files in the following order:
The configuration that you specify by using the
configfileinput argument of the
The configuration associated with the model.
The default configuration. The default configuration is either the default shipping configuration or the default configuration that you set. For more information on the default configuration, see Use Model Advisor Configuration Editor to Customize Model Advisor.
The Model Advisor loads the first configuration file that it finds and ignores other configuration files.