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.

 Akzeptierte Antwort

VBBV
VBBV am 8 Dez. 2022
Bearbeitet: VBBV am 8 Dez. 2022
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

Weitere Antworten (0)

Kategorien

Mehr zu Wind Power finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 8 Dez. 2022

Bearbeitet:

am 8 Dez. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by