If I use the built in menu function, can I then use "switch" and call the "case" by the order it appears on the menu?

2 次查看(过去 30 天)
choice = menu('Choose an option!','Set user name', 'Load data file');
switch choice
case 1
% Set user name
set_user_name();
case 2
% Load data file

采纳的回答

Image Analyst
Image Analyst 2016-11-18
Of course? Why wouldn't you be able to? And it looks like you actually tried it so don't you already know the answer?
  2 个评论
Kyle Reagan
Kyle Reagan 2016-11-18
My menu has 11 options, so I haven't completed it yet. I was wondering if the numbers have to have an apostrophe around them or if it can just be free-standing. (e.g. 1 vs '1')

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by