Tranfering data from one GUI uitable to another GUI uitable

1 view (last 30 days)
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?

Answers (1)

Fangjun Jiang
Fangjun Jiang on 31 Jul 2011
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);

Categories

Find more on App Building in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!