How can I set the variant object of a Variant Subsystem block based on the current value of a mask parameter in Simulink 7.8 (R2011b)?
6 views (last 30 days)
Show older comments
I am using a Variant Subsystem block. I would like to set the variant object based on the current value of a mask parameter.
Accepted Answer
MathWorks Support Team
on 1 Mar 2013
This can by achieved by using a Dialog callback, which is executed every time a parameter is changed. To access the Dialog callback, right click on the mask --> Edit Mask --> Parameter --> select the parameter of interest. The Dialog callback is in the lower right panel.
To get the current value of the mask parameter, include the following command in the Dialog callback:
currParamVal = get_param('modelName/maskName','parameterName')
To set the variant object, include the following command in the Dialog callback:
set_param('modelName/variantSubsystemName','OverrideUsingVariant','variantName')
Use IF/ELSEIF/ELSE in the Dialog callback to set the variant object based on the parameter value.
Please see the attached model for an example.
0 Comments
More Answers (0)
See Also
Categories
Find more on Component-Based Modeling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!