Azzera filtri
Azzera filtri

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

3 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Image Analyst
Image Analyst il 13 Apr 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

Più risposte (0)

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by