MATLAB: How to get SIMULINK to use Dialog Callbacks and not GUI Callbacks when having a block mask with a GUI build using GUIDE

callbackclockguiguidemasksimulink

I would like SIMULINK to use block dialog callbacks and not GUI callbacks. I designed a block mask with GUIDE. The GUI is called by the OpenFcn of the block. When a callback is executed in the GUI the callback functions of the GUI are called. I would like the block dialog callbacks to be called.

Best Answer

This is expected behaviour.
As a workaround you can modify the GUI MATLAB file to evaluate the callbacks of the SIMULINK block mask.
The following code illustrates how to do this:
names = get_param(gcb,'MaskNames');
callbacks = get_param(gcb,'MaskCallbacks');
eval(callbacks{find(strcmp(names,'callback_name'))});