MATLAB Answers

GUI and two .figs

1 view (last 30 days)
Hi,
I have two .figs. If I press button in fig 1, than is executed callback
function button_Callback(hObject, eventdata, handles)
h=findobj(0,'Type','figure','Tag','figure1');
UserData=get(h,'UserData');
UserData.a
open mm.fig
;
set(h,'UserData',UserData);
guidata(hObject, handles);
and figure mm.fig is open. But if I press again the same button like above, than I get error in UserData.a ??? Attempt to reference field of non-structure array.
Why I lose info about UserData.a???
Thanks

Accepted Answer

Walter Roberson
Walter Roberson on 1 Jul 2013
If both figures have the tag 'figure1' then the findobj() is going to return a vector of handles and the get() of Userdata would return a cell array.
  3 Comments
john
john on 8 Jul 2013
ok

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!