MATLAB: How to close one GUI figure window from another GUI using a uicontrol’s callback in MATLAB 7.8 (R2009a)

MATLAB

I have created two GUIs and I would like to close one of the GUIs from a second GUI using a UICONTROL's callback.

Best Answer

You can use FINDOBJ function to find the handle to the first GUI's figure window. Suppose the name of the first GUI is 'gui1' and the second GUI has a Push Button that should close gui1 when pushed. Insert the following code into the callback of a Push Button:
hf=findobj('Name','gui1');
close(hf)