Main Content


Change value of parameter in configuration reference

Since R2021a



    configset.reference.overrideParameter(model,parameter) overrides the parameter parameter in the active configuration reference that model uses. By default, a configuration reference uses the parameter values from the configuration set that it references and does not enable editing. Overriding a parameter enables editing in the configuration reference so that you can change the value for the parameter in the reference without changing the referenced configuration set. Changing the value in the referenced configuration set does not affect the value of the overridden parameter. Some parameters cannot be overridden.

    configset.reference.overrideParameter(model,parameter,value) overrides the parameter and sets the value in the configuration reference to value.


    collapse all

    Programmatically override a parameter in a configuration reference and set a value that is different from the referenced configuration set.

    Open the model slexConfigSetRefExample, which uses a configuration reference as the active configuration.

    model = 'slexConfigSetRefExample';

    Check if the model has any overridden parameters.

    ans = logical

    The model does not have any overridden parameters. For this example, override the parameter ModelReferenceNumInstancesAllowed. This parameter controls the number of times that the model can be referenced directly or indirectly by another model. In the referenced configuration set, the value is Multi. For the model slexConfigSetRefExample, override the parameter and set the value to Single so that it can be referenced only once by another model.


    Verify that the parameter ModelReferenceNumInstancesAllowed is overridden and check its value for the model.

    ans = logical
    ans = 

    Restore the parameter to the value in the referenced configuration set. Restoring the parameter makes it read-only again.


    If multiple parameters are overridden for the model, you can interact with all of them at once. For example, override the parameters StartTime, StopTime, and SolverType. Then, use the function configset.reference.getOverriddenParameters to see a list of the overridden parameters.

    ans = 3x1 string

    Now, restore all of the overridden parameters for the model. The parameters reset to the values in the referenced configuration set and become read-only again.


    Input Arguments

    collapse all

    Model that uses the configuration reference, specified as a character vector or string scalar.

    Example: 'mymodel'

    Parameter to override, specified as a character vector or string scalar.

    Example: 'ModelReferenceNumInstancesAllowed'

    Value to set for the overridden parameter, specified as a character vector or string scalar.

    Example: 'Multi'

    Version History

    Introduced in R2021a