Check if GUI is open
54 views (last 30 days)
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.
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.
More Answers (4)
Benjamin Avants on 17 Oct 2017
I know this question is old, but GUIDE created figures don't show up as results from findobj.
figure2handle = findall(0,'Tag','figure2');
% figure exists
Nepenthes on 17 Jul 2018
This is a little late, but I chanced upon this solution when tackling a similar problem. H.isvalid or isvalid(H) should work. H can be a single handle, or a vector of handles. K>> H = figure; K>> G = plot(rand(5)); K>> delete(G(3:4)); K>> G.isvalid ans = 1 1 0 0 1 K>> H.isvalid ans = 1 K>> delete(H) K>> H.isvalid ans = 0
Kristoffer Walker on 21 Oct 2020
None of the above seems to work for me when I am trying to detect if a GUI created from AppDesigner is open. Does anyone know how to do this with AppDesigner GUI's?