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.
Muazma Ali
Muazma Ali 2017년 12월 13일
it was the whole error message I got..
KL
KL 2017년 12월 14일
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