Effacer les filtres
Effacer les filtres

Menu function - would like menu to pop back up after choice made

3 vues (au cours des 30 derniers jours)
Matthew Piccolo
Matthew Piccolo le 13 Avr 2017
Commenté : Matthew Piccolo le 13 Avr 2017
I am creating a pop-up menu as a final project for one of my courses. I am in the very beginning stages, here is what I have so far:
choice = menu('Statistical Analysis','Set username','Load data file','Clear data','Set output filename','Plot histogram','Plot histogram fit','Plot probability plots','Regression of y on x','Find probability (x or z)','Find x or z','Exit')
switch choice
case 1
username = input('Please input your username:\n','s')
case 11
close all
end
I have noticed after I select choice 1, to input username, I type in my username, and the menu itself closes. I would like the menu to re-open after a choice has been made, and only close once the exit option has been chosen.

Réponse acceptée

Image Analyst
Image Analyst le 13 Avr 2017
Try putting it in a while loop:
choice = 1;
while choice ~= 11
choice = menu('Statistical Analysis','Set username','Load data file','Clear data','Set output filename','Plot histogram','Plot histogram fit','Plot probability plots','Regression of y on x','Find probability (x or z)','Find x or z','Exit')
switch choice
case 1
username = input('Please input your username:\n','s')
case 11
close all
end
end

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by