Main Content

saveConfiguration

Save Model Advisor configuration to JSON file

Since R2024b

    Description

    saveConfiguration(CfgObj,fileName) saves the active Model Advisor configuration accessed by the CfgObj object to a JSON file with the name specified in fileName. If you want to save the file to a specific location other than your working directory, specify the absolute path in fileName.

    If you customize an existing Model Advisor configuration, you can use the saveConfiguration function to save the customization to the original JSON file by specifying the filename or its absolute path.

    example

    Examples

    collapse all

    This example shows how to save an existing Model Advisor configuration after customization to

    • Its original JSON file myCustomFile.json

    • A new JSON file named newConfig.json in the C:\Users\New Folder folder.

    Create a Model Advisor configuration object.

    CfgObj = Advisor.Config;

    Load the myCustomFile.json file, located in your working directory.

    loadConfig(CfgObj,"myCustomFile.json");

    Add the checks whose IDs are mathworks.jmaab.jc_0231 and mathworks.jmaab.jc_0222 under the root node.

    addCheck(CfgObj,"_SYSTEM","mathworks.jmaab.jc_0231");
    addCheck(CfgObj,"_SYSTEM","mathworks.jmaab.jc_0222");
    

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

    saveConfiguration(CfgObj,"myCustomFile.json");

    Save the customized configuration to a new file newConfig.json in the C:\Users\New Folder folder.

    saveConfiguration(CfgObj,"C:\Users\New Folder\newConfig.json");

    Input Arguments

    collapse all

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

    Name of JSON file, specified as a character vector or string scalar. If you want to save the JSON file in a location other than the working directory, specify the absolute path as a character vector or string scalar.

    Example: "myCustomFile.json"

    Example: "C:\Users\New Folder\newConfig.json"

    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, after customization to save the configuration to a JSON file, click Save As and specify the location and name of the file. For more information, see Use the Model Advisor Configuration Editor to Create a Custom Model Advisor Configuration.

    Version History

    Introduced in R2024b