I have in my first figure GUI1 a table and a button that will open a new window with a table GUI2. How is it possible in matalab, to add in the table GUI1 a row data of the selected line in Table 2.
I've try first to select the row number with tihis method:
function cellSelect(src,evt)
index = evt.Indices;
if any(index)
rows = index(:,1);
set(src,'UserData',rows);
end
end
For
To share data between two window, but I don' know how to use this correctly:
b=get(handles.edit2,'String');
setappdata(0,'ReturnText',b);
I don't have the time to try things out, it's always very time consuming for GUI questions, so I just can give you some code lines to play with.
In the first step you need to give every table a tag name:
f1 = figure; %first figure
t1 = uitable(f1); %first table
set(t1,'Tag','TableOne');
f2 = figure; %second figure
t2 = uitable(f2); %second table
set(t2,'Tag','TableTwo');
Now you can find your tables in the callback function and access their data:
function cellSelect(src,evt)
index = evt.Indices; %get index of desired row
row = index(1,1);
t1 = findobj('Tag','TableOne');
data1 = get(t1,'Data');
rowdata = data1(row,:);
t2 = findobj('Tag','TableTwo');
data2 = get(t2,'Data');
set(t2,'Data',[data2;rowdata]);
end