Tranfering data from one GUI uitable to another GUI uitable

1 次查看(过去 30 天)
I prepared two GUIs with their M-file names as "retrieve2withD" and "GUIcommut1". I want to transfer Data from one of the uitable in "retrieve2withD" with Tag 'uitable3' to another uitable in "GUIcommut1" with Tag 'uitable2'. I'm trying to do this by using 'findobj' in the Opening Function of "GUIcommut1" to call for all the handles in "retrieve2withD" so that I select and set the handle I need for transfering the Data. But the result I got seems not to be working. Please how do I deal with this problem? Thank you.
Code used in the Opening Function of "GUIcommut1" and the result I got:
(1)
retrieve2withDHandle = findobj(retrieve2withD);
set(handles.uitable2,'Data',retrieve2withDHandle);
assignin('base','retrieve2withDHandle', retrieve2withDHandle)
guidata(hObject,handles)
(2)
I also used the following code in the pushbutton callback function of the GUI to transfer the Data to the uitable2 but result shown in the table is this Data shown below, instead of the Data contained in uitable3 of "retrieve2withD".
global gal
gal = get(handles.uitable2,'Data');
set(handles.uitable2,'Data',gal)
assignin('base','gal', gal)
>> retrieve2withDHandle
retrieve2withDHandle =
1.0e+002 *
1.820062255859375
1.830062255859375
2.090062255859375
2.080062255859375
2.070062255859375
2.060062255859375
2.050062255859375
2.040062255859375
2.030062255859375
2.020062255859375
2.010062255859375
2.000062255859375
1.990062255859375
1.980062255859375
1.970062255859375
1.960062255859375
1.950062255859375
1.940062255859375
1.930062255859375
1.920062255859375
1.910062255859375
1.900062255859375
1.890062255859375
1.880062255859375
1.870062255859375
1.860062255859375
1.850062255859375
1.840062255859375
Please, how do I tranfer the required Data?

回答(1 个)

Fangjun Jiang
Fangjun Jiang 2011-7-31
Why don't you just put the following code in your push button callback function? Assume the tag 'uitable3' is unique.
h_uitable3=findobj('Tag','uitable3')
Data=get(h_uitable3,'Data');
set(handles.uitable2,'Data',Data);

类别

Help CenterFile Exchange 中查找有关 App Building 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by