This happens because the createFcn is intended for initialization of the properties of the uicontrols and axes.
The problem arises because of two things:
- the exact timing of the execution of these functions;
- and the fact that PLOT or IMAGE will reset the axes properties by default.
During initialization of the GUI, the createFcns are executed just before the openingFcn. When GUIDE is launched to edit a GUI, it will initialize the GUI up to (not including) the openingFcn. Since IMAGE will reset and clear axes properties (unless the command "hold on" has been used), this results in the tag and callbacks being wiped from GUIDE and the property inspector.
The solution is to use the openingFcn instead of the createFcn. This is the recommended way to initialize images and plots.
Best Answer