request user for input

hi!
dont know why I am getting error here, shouldnt i think, its quite a simple syntax:
svar=input('answer yes:y or no:n. ', 's');
Index exceeds matrix dimensions.

3 个评论

KL
KL 2017-12-13
编辑:KL 2017-12-13
Your usage of input command is fine. I reckon you get the error while trying to index svar (not while getting it from the user). Post the complete error message with the line it points to.
it was the whole error message I got..
No, it's not. Complete error message means all of the red text.

回答(1 个)

Walter Roberson
Walter Roberson 2017-12-14

0 个投票

You have accidentally created a variable named input so when you think you are calling the function index you are actually trying to access the variable.

此问题已关闭。

标签

提问:

2017-12-13

关闭:

2021-8-20

Community Treasure Hunt

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

Start Hunting!

Translated by