MATLAB: How to find an uifigure

find uifigure findobj uitree findallMATLAB

I am mixing some old GUIs designed with GUIDE with uifigures, so I can use the uitree object (and some others).
However, when I try to establish communication between some functions in my GUIs (need to click on an ax and then assign some value from a tree node and insert into a table) I cannot find the uifigure – neither using "findobj ('Type', 'figure')" nor using "findall (groot)". Before I started this design I did not even consider this possibility, thought it would be something quite simple – which it probably is but I cannot get past this point.
Would really appreciate any answer or a possible solution to this issue.

Best Answer

You can find the uifigure handle using findall() but it's not recommended to merely find handles to all figures because it's quite likely that at some point other figures will exist other than your GUI.
To find the handle to your GUI figure, add a long, descriptive, unique name to the tag property of your GUI. Then specify that unique tag name when searching for the GUI handle.
uif = uifigure('Tag','MyUniqueTag'); % a demo ui-figure with a unique tag name
h = findall(0,'Type','figure','tag','MyUniqueTag') % Get the handle.
To search for all figures (hidden or not)
h = findall(0,'Type','figure');