Link two row in a table

조회 수: 1 (최근 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 CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품


릴리스

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by