Menu function - would like menu to pop back up after choice made
2 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
Image Analyst
2017-4-13
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
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!