Help using menu option
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to write a code that a menu pops up and the user chooses between two options. Based off of what they choose, there are two different sections of code that would run. I am assuming I need an if statement after the menu option based off of what they choose to seperate between the two sections of code but I am not sure how to do that.
0 comentarios
Respuestas (2)
Image Analyst
el 24 de Oct. de 2021
Editada: Image Analyst
el 24 de Oct. de 2021
Example from the help:
list = {'Red','Yellow','Blue',...
'Green','Orange','Purple'};
[index, tf] = listdlg('ListString', list);
or try questdlg():
promptMessage = sprintf('Which option do you want?');
titleBarCaption = 'Which option?';
buttonText = questdlg(promptMessage, titleBarCaption, 'Option 1', 'Option 2', 'Option 1');
if contains(buttonText, '1', 'IgnoreCase', true)
% They selected option 1.
else
% They selected option 2.
end
0 comentarios
Ver también
Categorías
Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!