0
드롭 다운 메뉴를 사용하여 Matlab에서 uitable을 만들 수 있습니다. 가 어떻게 든 드롭 다운 메뉴가드롭 다운 메뉴가있는 Uitable matlab
스위치/케이스 업데이트되지 않습니다 나는 경우 다른 조건 스위치/케이스를 대체했습니다. 드롭 다운 메뉴가 업데이트되지만 원하는 출력이 나오지 않습니다!
은 어떤 생각이나 포인터를아래의 코드를 실행하십시오 시뮬레이션?
function [] =foouitable()
f = figure('Position',[100 100 400 150]);
% Column names and column format
columnname = {'Available','Options','SubOptions'};
columnformat = {'logical','bank',{'CheckBox' 'SelectSubOptions'}};
% Define the data
d = {false 'Reconstruction' 'CheckBox';...
false 'Segmentation' 'CheckBox';...
false 'ComputerTomography' 'CheckBox';...
false, 'UltraSound', 'CheckBox';...
false, 'AcousticEmission', 'CheckBox'};
% Create the uitable
t = uitable('Data', d,...
'ColumnWidth', {70 120 100},...
'ColumnName', columnname,...
'ColumnFormat', columnformat,...
'ColumnEditable', [true false true],...
'RowName',[],...
'CellEditCallback',@edit)
set(t,'Tag','Config_table');
function edit(src,evt)
if evt.Indices(2) == 1
modifyPopup(src)
end
end
% Set width and height
t.Position(3) = t.Extent(3);
t.Position(4) = t.Extent(4);
function modifyPopup(src)
id_group_1 = {'A.1';'A.2';'A.3'};
id_group_2 = {'B.1';'B.2';'B.3'};
id_group_3 = {'C.1';'C.2';'C.3'};
id_group_4 = {'D.1';'D.2';'D.3'};
id_group_5 = {'E.1';'E.2';'E.3'};
id_default = {'CheckBox'};
config_data = get(src,'Data');
selector = config_data(1:5,1);
selector = cell2mat(selector);
config_format = get(src,'ColumnFormat');
if isequal(selector(1),1)
config_format{3} = id_group_1';
elseif isequal(selector(2),1)
config_format{3} = id_group_2';
elseif isequal(selector(3),1)
config_format{3} = id_group_3';
elseif isequal(selector(4),1)
config_format{3} = id_group_4';
elseif isequal(selector(5),1)
config_format{3} = id_group_5';
else
config_format{3} = id_default;
end
set(src,'Data',config_data);
set(src,'ColumnFormat',config_format);
end
end
미리 감사드립니다.
복잡한 주석 처리를 제거하지 않고 문제를 재현하는 코드를 제공하고 원하는 결과가 무엇인지 설명하십시오. – excaza
나는 내 excaza 제안으로 코드를 편집했다. 확인란 중 하나를 선택하면 해당 드롭 다운 메뉴에서 그룹 값을 표시하고 다른 드롭 다운 메뉴는 변경되지 않은 상태로 유지해야합니다. – sssc
'config_data'가 아닌'if' 블록에서'config_format'을 왜 수정하고 있습니까? 왜 ''ColumnFormat ''을 수정하고 있습니까? – excaza