I want to mask a variant subsystem consisting of two subsystems using mask initialization and the following code derived from "slexMaskingExample". I want to set the mode to speed or torque control and thereby use either of the speed or torque controllers to fulfil my purpose. I expect this to reduce my simulation time as the other block shoudl be inactive during the simulation as described by the Label Mode Active Variant in the Block parameters of the Variant subsystem.
But the problem is the underlying code does not make the other controller inactive while simulation. During simulation, both the subsystems are runnning. DUring editing, the results are as desired.
The mask initialization code is as follows:
simulationStatus = get_param(bdroot,'SimulationStatus');choice = get_param(gcb,'Mode'); Blk = gcb; if strcmp(choice,'Speed') set_param(Blk, 'LabelModeActiveChoice', 'SpeedC'); else set_param(Blk, 'LabelModeActiveChoice', 'TorqueC'); end
Kindly help
Best Answer