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.

 Respuesta aceptada

VBBV
VBBV el 8 de Dic. de 2022
Editada: VBBV el 8 de Dic. de 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

Más respuestas (0)

Categorías

Más información sobre Wind Power en Centro de ayuda y File Exchange.

Preguntada:

el 8 de Dic. de 2022

Editada:

el 8 de Dic. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by