Algorithm with inputdlg command
6 次查看(过去 30 天)
显示 更早的评论
¡Hello everyone!, I need your collaboration with this algorithm, this must be written on a script.
- Make a menu that allows the following:
MAIN MENU
- Read the name and identification number (ID) of the user.
- Print the name and the user identification number (ID) on the screen.
- Indicate whether the user is over or under 30 years old.
- Exit.
Make use of the CASE structure for this menu and develop each option.
Thanks.
3 个评论
Walter Roberson
2012-11-20
Please edit this question to have a better title, as the current title has no information about what you are trying to do; your title could apply to most questions that are posted here.
采纳的回答
Image Analyst
2012-11-19
Hints:
- inputdlg()
- fprintf()
- "if" statement
- return
4 个评论
Image Analyst
2012-11-19
Was there something about this
prompt = {'Enter matrix size:','Enter colormap name:'};
dlg_title = 'Input for peaks function';
num_lines = 1;
def = {'20','hsv'};
answer = inputdlg(prompt,dlg_title,num_lines,def);
that's unusually difficult to adapt? Why can't you just say "Enter your name" instead of "Enter matrix size" and "Enter your age" instead of "Enter colormap name"? Did you try that? To get numbers instead of cells, you might do this:
theirAge = str2double(answer{2})
更多回答(1 个)
Jan
2012-11-19
Reading the "Getting Started" chapters of the documentation is a good point to start from. Then define the problem exactly. E.g. "read the name" could mean reading a handwritten name on a sheet of paper, reading from an USB stick or computer readable batch, from the keyboard of from a list on the hard disk.
The indication whether the user is over or under 30 years old, is not clear also: How do you want to decide this?
2 个评论
Jan
2012-11-20
Sorry, James, this still demands for too much guessing. What is "on the fields"? Does "print on screen" mean a text in a figure or in the command line? How is the age indicated? Please try to be a clear as possible and consider, that we do not have the faintest idea of what you are wanting to achieve. The less we have to guess, the more efficient and likely is a helpful answer.
I assume, that this is a homework question.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating, Deleting, and Querying Graphics Objects 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!