Info

この質問は閉じられています。 編集または回答するには再度開いてください。

I need help with inputs

2 ビュー (過去 30 日間)
Allyson
Allyson 2014 年 2 月 20 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
input the area code of your telephone number and store the input in a variable named “AreaCode”. The variable “AreaCode” is to be of type “Char”. Use the input() function once to put 3 newlines BEFORE the prompt “Enter your Area Code --> ”. The string “Your area code is ” is to be outputted with value of the variable “AreaCode” on the same line. A newline is outputted at the end.

回答 (2 件)

Walter Roberson
Walter Roberson 2014 年 2 月 21 日
Have a look at the second syntax for input() http://www.mathworks.com/help/matlab/ref/input.html

Image Analyst
Image Analyst 2014 年 2 月 21 日
You can use sprintf() to create a string that can be used as a prompt in input(). For example, to put 2 new lines (\n) followed by a string, you can do this:
userPrompt = sprintf('\n\nEnter some stuff:');
Adapt it to your homework and send it into input() or inputdlg(). Put a \n anywhere you want a new line in your string.

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by