MATLAB: How to prevent MATLAB from creating axes on the GUIs

axesaxisfigureguikeepMATLABnewplacvepreventputstop

When a GUI that I created is the current figure, any plot commands add an axes to that GUI.
uicontrol
plot(1:10)

Best Answer

To fix this problem, change the "HandleVisibility" property of your GUI figure to 'Off' or 'Callback'. Setting this property to 'Off' will keep any functions or commands from modifying the GUI. If you change this property to 'Callback', only callbacks of objects in the figure will be able to add plots.
To change this property in GUIDE (R12 and later) select Tools->Application Options. Then, change the Command Line Accessibility to 'Off'.