GUI creating multiple objects with the same Tag

3 visualizzazioni (ultimi 30 giorni)
I have a GUI created with GUIDE named WGE_GUI and with the tag WGE_GUIh. When I run the GUI, if I insert the code
h = findobj('Tag','WGE_GUIh')
right after the GUI is made visible, then h is a 1x1 with Class of matlab.ui.Figure.
However, I have a pushbutton that when clicked runs the same findobj function as above and it returns the following:
h =
3x1 Figure array:
Figure (WGE_GUIh)
Figure (WGE_GUIh)
Figure (WGE_GUIh)
All the Figures in h seem to have the same properties, but I can't determine why there are multiple figures with the same tag. All of their FileNames (e.g. h(1).FileName) are identical and point to the GUI .fig file on my hard drive.
I'm not really sure what I'm looking for when I'm debugging. I have other buttons that use the findobj function, as well as setappdata and getappdata to pass variables between GUIs, but I get this behavior even if those aren't used. Any help would be appreciated!

Risposte (1)

Walter Roberson
Walter Roberson il 5 Feb 2018
Some of the objects might have HandleVisibility set to 'callback'; see https://www.mathworks.com/help/matlab/creating_plots/preventing-access-to-figures-and-axes.html
At the command line, try findall() instead of findobj()

Categorie

Scopri di più su Specifying Target for Graphics Output in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by