Using listdlg, with muitlple selection to plot graphs

I am using 'listdlg' function with the Mutiple selection, so the user can select two different items from a list with Mutiple items. When two items are selected, I want the program to plot one bar graph. How would use 'if' or 'case' statements to do this. The list: rain sun snow wind
for example, if 'rain and sun' are selected, it plots (x,y) whereas if 'snow' and 'wind' are selected, it plots (s,t) any help would be much appreciated thanks alot.

 채택된 답변

VBBV
VBBV 2022년 12월 8일
편집: VBBV 2022년 12월 8일
list = {'Rain','Sun','Snow','Wind'};
[indx,tf] = listdlg('ListString',list)
if tf
if strcmp(string(list(indx(1))),"Rain") & strcmp(string(list(indx(2))),"Sun")
disp('plotting Rain and Sun')
%plot here
elseif strcmp(string(list(indx(1))),"Snow") & strcmp(string(list(indx(2))),"Wind")
disp('plotting Snow and Wind')
%plot here
else
disp('Incorrect selection')
end
else
disp('Please make a selection')
end
you can use if-else to check the selection and plot accordingly

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 App Building에 대해 자세히 알아보기

질문:

2022년 12월 8일

편집:

2022년 12월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by