uitable and get/setappdata

조회 수: 6 (최근 30일)
Daniel Kin
Daniel Kin 2013년 4월 8일
I have a uitable data which I need to transfer its content from one GUI to another. Following the well citied link: http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F
I used a Pushbutton with get/setappdata and I get an error (Reference to non-existent field 'quantTable'.), any reason why?
GUI1:
function transData_Callback(hObject, eventdata, handles)
handles.output = hObject;
setappdata(handles.quantTable,'data','datatable');
GUI2-under the OpeningFcn function:
my=getappdata(handles.quantTable,'datatable');

답변 (1개)

Sean de Wolski
Sean de Wolski 2013년 4월 8일
More than likely the handles structure from the first GUI is not being passed to the second GUI. I.e. the second GUI is using its handles structure which does not have a quantTable field.
Thus when you call the second GUI, you need to pass in the handles structure from the first, and use it in the OpeningFcn.
From GUI1:
gui2(handles); %call gui2 and give it handles from itself
In GUI2, store it and use it!
  댓글 수: 1
Daniel Kin
Daniel Kin 2013년 4월 8일
I entered the gui2(handles) in the gui1 OpeningFcn and still I get the "Reference to non-existent" error. I was not sure if you meant to enter it in gui2 but in this case the gui2 is in endless loop, so it is not working as well.
Any idea how to advance?
Thanks.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by