Hi everyone.I need help. I am trying to write a set of input statements that prompt the user for his/her favorite band, favorite song, favorite restaurant, and favorite food but i keep getting the same error message. What could be the problem?

4 views (last 30 days)
favoriteband= input ('Please enter your favorite band:','s');
favoritesong= input ('\n Please enter your favorite song:','s');
favoriterestaurant= input('\n Please enter your favorite restaurant:','s');
favoritefood= input('\n Please enter your favorite food:','s');
Undefined function or method 'question' for input arguments of type 'char'.
  8 Comments
GEORGE WAYNE MWANGI
GEORGE WAYNE MWANGI on 15 May 2017
Do the following in a script file. You can then copy the commands from your script file and the resulting output into this document. (a) Write a set of input statements that prompt the user for his/her favorite band, favorite song, favorite restaurant, and favorite food. (b) Write two fprintf statements. The first statement should display the user’s favorite band and favorite song. The second statement should display the user’s favorite restaurant and favorite food on a new line.

Sign in to comment.

Accepted Answer

Jan
Jan on 14 May 2017
How do you start the shown code? Is it stored in a script or function file called "question.m"? Then this file might not be in one of the folders contain in Matlab's path. Store it in a user defined folder than and attach this folder to the path - see:
doc addpath
Or perhaps you wanted to store the code in such a file but have a typo in the file name.
But these are bold guesses only. This would not explain, why Matlab searchs for a function with a char as first input. This will get clear, if you post the complete code and explain, how you start it.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!