MATLAB: How to open the dialog parameters of a block inside a subsystem when double-clicking the subsystem

simulink

I have a subsystem in my model which contains a bus-selector block. I would like to be able to double-click on the subsystem and have that GUI appear so I can select the busses directly. I know I can create a mask but it is not that simple to pass the commands to the bus selector.

Best Answer

It is possible to programatically open the Dialog of a given block using the 'open_system' command, giving the block path as a parameter. To extend this functionality to allow this GUI to be opened when you select another block, you can place this command in the 'OpenFcn' callback function. I have attached a model which demonstrates this approach. By opening the subsystem named 'Masked Subsystem', the dialog box for the bus selector will be shown. The callback can be seen by right-clicking on the block, selecting properties and finding 'OpenFcn' on the Callbacks tab. It is worth noting that by using this callback on a Masked subsystem, it is possible to bypass this callback by using the 'Look under mask' option or by using the shortcut Ctrl+U.