MATLAB: How to execute a callback when the block choice property is changed in a Configurable Subsystem in Simulink 6.2 (R14SP2)

backblockchoicecallchangeconfigureexecutefunctionpropertyrunscriptsimulink

I have a Configurable subsystem in my model and I would like to execute a callback whenever I change the block choice.

Best Answer

The ability to specify a callback that executes when a user changes the block choice in a Configurable Subsystem is not available in Simulink.
To work around this issue, you could use the mask initialization commands to implement the callback. When the block choice is changed, the mask initialization commands of the new block are executed, so you may be able to use these commands as your block choice callback. Note that these commands are also executed when the model is first opened.
To add mask initialization commands to a subsystem, right-click on the subsystem and choose 'Mask subsystem', then go to the Initialization pane of the Mask dialog box and enter whatever you would like in the 'Initialization commands' edit box.