How to program changing Masks to a variant subsystem?
1 view (last 30 days)
Show older comments
Hi,
I am creating a variant subsystem with several options and I would like to know how can I create a mask that changes according to the different variant.
BTW: if it is possible, I want to use the "picture" of the subsystem (or how the subsystem model looks) as mask.
Thanks a lot
0 Comments
Answers (1)
Meet
on 11 Oct 2024
Hi Joaquin,
To change the mask parameters according to the variant you select from the variant subsystem, you can utilize the ‘mask editor callbacks’. These callbacks are triggered when the variant of the subsystem is modified. You can add an initialization callback with the function provided below:
function MaskInitialization(maskInitContext)
% maskObj will act as object which would be used to control parameters of the mask
maskObj = maskInitContext.MaskObject
% choice variable defined in base workspace, which would be used to select the variant
choice = evalin('base','choice');
% Here I have changed the image of the variant subsystem block as an example, you could use the parameter you want to change accordingly
switch choice
case 1
maskObj.Display = 'image("model1.png");';
case 2
maskObj.Display = 'image("model2.png");';
end
end
You can refer to the documentation links below for more information:
Attaching the model and images I used for your reference.
Hope this helps!!
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!