Filters in pop up menu
조회 수: 1 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (1개)
VBBV
2024년 3월 29일
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
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!