Main Content

setInputParameters

Update input parameter for a check

Since R2025a

    Description

    setInputParameters(cfgObj,checkInstanceID,inputParameterStruct) updates the specified structure value of input parameter specified by inputParameterStruct for the check checkInstanceID using the provided values in the Model Advisor configuration accessed by the cfgObj object.

    example

    Examples

    collapse all

    Update the input parameters of a check in a Model Advisor configuration.

    Create a Model Advisor configuration object.

    cfgObj = Advisor.Config;

    Load the myCustomFile.json file. Loading this file allows you to set the JSON file as an active configuration, providing you with access to edit it.

    loadConfig(cfgObj,"myCustomFile.json");

    Get the input parameters of the check mathworks.maab.db_0140 in the folder _SYSTEM_By Product_Simulink Check_Modeling Standards_JMAAB v5.1 Checks. You can obtain the check instance ID in the Model Advisor when you select the check mathworks.maab.db_0140.

    inputParams = getInputParameters(cfgObj,"_SYSTEM_By Product_Simulink Check_Modeling Standards_JMAAB  v5.1 Checks_mathworks.maab.db_0140")
    

    The getInputParameters function returns the input parameters of the check mathworks.maab.db_0140 in a structure.

    inputParams = 
     1×4 struct array with fields:
     name
     type
     value
    

    Get the value of the input parameter field from the struct array that you want to change.

    inputParams(3).value

    ans =
        'on'  

    Change the value of the fetched input parameter.

    inputParams(3).value = 'off'

    Update the changed input parameter.

    setInputParameters(cfgObj,"_SYSTEM_By Product_Simulink Check_Modeling Standards_JMAAB  v5.1 Checks_mathworks.maab.db_0140",inputParams)

    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 from which you want to get the input parameters.

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

    Values for input parameter which overwrites the existing values.

    Version History

    Introduced in R2025a