configset.reference.getOverriddenParameters
Description
returns the parameters that are overridden in the configuration reference that is active for
the model.parameters
= configset.reference.getOverriddenParameters(model
)
Examples
Override Parameters in a Configuration Reference
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';
open(model)
Check if the model has any overridden parameters.
configset.reference.hasOverriddenParameters(model)
ans = logical
0
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.
configset.reference.overrideParameter(model,"ModelReferenceNumInstancesAllowed","Single");
Verify that the parameter ModelReferenceNumInstancesAllowed
is overridden and check its value for the model.
configset.reference.isParameterOverridden(model,"ModelReferenceNumInstancesAllowed")
ans = logical
1
get_param(model,"ModelReferenceNumInstancesAllowed")
ans = 'Single'
Restore the parameter to the value in the referenced configuration set. Restoring the parameter makes it read-only again.
configset.reference.restoreOverriddenParameter(model,"ModelReferenceNumInstancesAllowed");
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.
configset.reference.overrideParameter(model,"StartTime"); configset.reference.overrideParameter(model,"StopTime"); configset.reference.overrideParameter(model,"Solver"); configset.reference.getOverriddenParameters(model)
ans = 3x1 string
"StartTime"
"StopTime"
"Solver"
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.
configset.reference.restoreAllOverriddenParameters(model)
Input Arguments
model
— Model that uses configuration reference
character vector | string scalar
Model that uses configuration reference, specified as a character vector or string scalar.
Example: 'mymodel'
Output Arguments
parameters
— Overridden parameters
string array
Overridden parameters, returned as a string array.
Version History
Introduced in R2021a
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)