Borrar filtros
Borrar filtros

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

3 visualizaciones (últimos 30 días)
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.

Respuesta aceptada

Image Analyst
Image Analyst el 13 de Abr. de 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

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by