Azzera filtri
Azzera filtri

Link two row in a table

5 visualizzazioni (ultimi 30 giorni)
Cristian Martin
Cristian Martin il 31 Ago 2022
Risposto: Seth Furman il 3 Set 2022
In a GUI a have two tables , trough a button when select a row from the upper table it send to the bottom table like this:
D=get(handles.uitable1,'Data');
Index=get(handles.uitable1,'UserData');
a = D(Index.Indices(:,1), :);
old_data=get(handles.uitable4,'Data');
old_data = array2table(old_data);
new_data = [old_data; a];
set(handles.uitable4, 'Data',new_data);
I have two perform an extra action , so when the user push that button an dialog window ask him if he want to link a new entry from the upper table with an existing one from the second table and if he is agree to force the user to select a row from the second table.
I tried to do something like this:
D=get(handles.uitable1,'Data');
Index=get(handles.uitable1,'UserData');
a = D(Index.Indices(:,1), :);
answer = questdlg('Link entry?', ...
'Atention !', ...
'YES','NO','No thank you');
switch answer
case 'YES'
%%% HERE I DONT KNOW TO FORCE USER TO SELECT A ROW FROM uitable4
D=get(handles.uitable4,'Data');
Index=get(handles.uitable4,'UserData');
variable_for_further_purpose = D(Index.Indices(:,1), :); % This I will use for further_purpose
%%%
old_data=get(handles.uitable4,'Data');
old_data = array2table(old_data);
new_data = [old_data; a];
set(handles.uitable4, 'Data',new_data);
case 'NO'
old_data=get(handles.uitable4,'Data');
old_data = array2table(old_data);
new_data = [old_data; a];
set(handles.uitable4, 'Data',new_data);
end
Thanks !

Risposte (1)

Seth Furman
Seth Furman il 3 Set 2022
In App Designer and apps created with the uifigure function, uiconfirm is recommended over questdlg because it provides additional customization options.

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Prodotti


Release

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by