Prompt user for a text string

조회 수: 868 (최근 30일)
Krish Desai
Krish Desai 2015년 11월 8일
댓글: Walter Roberson 2021년 6월 24일
This keeps coming up as an error, what am I doing wrong?
prompt= 'State your name, Your Grace ';
name=input(prompt);

채택된 답변

Chad Greene
Chad Greene 2015년 11월 8일
I think you want
name=input(prompt,'s');
to specify a string.
  댓글 수: 2
Somil Ajmera
Somil Ajmera 2020년 10월 23일
Thank you
Joseph Armstrong
Joseph Armstrong 2020년 12월 11일
Thanks been trying to solve this 's' needed to be in thanks so much

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

k khaja
k khaja 2021년 3월 7일
Hi,
Can anyone please show me, after prompt the user input, how can I append the strings in same cell,
Thanks in advanvce.
  댓글 수: 3
victoria thomas
victoria thomas 2021년 6월 23일
편집: Walter Roberson 2021년 6월 24일
ais=input('Give me a letter you would like converted to a number: ','s')
alphabet=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
for k=1:1:26
if strcmp(ais,alphabet(k))==1
disp([char(ais) ' is letter ' num2str(k) ' in the alphabet!'])
end
end
Walter Roberson
Walter Roberson 2021년 6월 24일
I do not see how that code is a solution to any topic that was being discussed here?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by