MATLAB: Check if GUI is open

guiguideMATLAB

Hi everybody
I believe the answer to this question already exists several times online, but everything I tried failed.
I got in a GUI-figure the option to open an other GUI-figure. In the second GUI I got plots and the first one can update these plots. Therefore its interesting to know if the second GUI is already/still open when I activate the update.
I tried:
~isempty(findobj('Tag','figure2'))
~isempty(findobj('Tag','axesInFigure2'))
~isempty(get(groot,'figure2'))
isgraphics(h,'figure2')
but I get the same result no matter if figure2 is open or not.
Is there an other way to get this information? I think of eventlisteners: figurehasbeenopened, figurehasbeenclosed
Thanks for help.

Best Answer

Keep hold of the handle of the figure when you launch it.
Then just do a
if ishghandle( otherFigureHandle )
or
if isgraphics( otherFigureHandle )
test when you want to see if it is open or not.