필터 지우기
필터 지우기

Filters in pop up menu

조회 수: 1 (최근 30일)
Basanagouda Kenchanagoudra
Basanagouda Kenchanagoudra 2019년 11월 5일
답변: VBBV 2024년 3월 29일
I have code which reads Test.csv data into GUI into two pop up menus like below.
The code I have used is
My requirement is,
1.) Wanted to get only Bus companies in the Register pop up menu when Bus is selected Module pop up menu
Right now, all the items are coming in Register pop up menu when I select anything in Module pop up menu.
Its like adding filters in the excel file.
Can anyone help me here??
Thanks in advance

답변 (1개)

VBBV
VBBV 2024년 3월 29일
Hi @Basanagouda Kenchanagoudra, You can use switch-case inside the Callback as shown below
Item = get(handles.Module_PopUp,'String') % get the unique list of items
ItemV = get(handles.Module_PopUp,'Value') % get the value of item selected in popupmenu
switch Item{ItemV} % use a swtich case for filtering items
case 'Bike'
idx = find(get_module_names == "Bike"); % search for similar items /bike
set(handles.Reg_PopUp,'String',get_reg_names(idx));
case 'Car'
idx = find(get_module_names == "Car") % search for similar items /car
set(handles.Reg_PopUp,'String',get_reg_names(idx));
case 'Bus'
idx = find(get_module_names == "Bus"); % search for similar items /bus
set(handles.Reg_PopUp,'String',get_reg_names(idx));
end

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by