Each handles structure is associated with a particular figure. When you are using GUIDE, the handles structure that would be automatically referenced on your behalf would belong to the figure (GUI) that the graphics object is part of. That handles structure is not going to know anything about the handles structure of the other figure (GUI) unless you specifically passed in that information.
When the first GUI calls upon the second GUI, the figure handle of the second GUI will be returned to the caller in the first GUI. The first GUI can then use guidata() on the second figure's figure handle in order to get the second GUI's handles, and the first GUI can then write the first GUI's figure handle into the second GUI's handles. Then in the second GUI, when something is needed out of the first GUI, that recorded figure handle can be used to retrieve the first GUI's handles. For example,
fig1 = gcf();
fig2 = SecondGUI();
handles2 = guidata(fig2);
handles2.fig1 = fig1;
guidata(fig2, handles2);
and in second GUI
function some_callback(hObject, event, handles)
fig1 = handles.fig1;
handles1 = guidata(fig1);
get(handles1.T, 'String')
Alternately, in the case where there is only one object with the tag T, you can skip all of this and instead use
function some_callback(hObject, event, handles)
T = findall(0, 'Tag', 'T');
get(T, 'String')
findall can search all objects in all figures. It is not as efficient as the code from above, and you have complications if there are multiple objects with the same Tag.
Best Answer