Link two row in a table

3 ビュー (過去 30 日間)
Cristian Martin
Cristian Martin 2022 年 8 月 31 日
回答済み: Seth Furman 2022 年 9 月 3 日
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 !

回答 (1 件)

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

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

製品


リリース

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by