Prompt user for a text string

794 次查看(过去 30 天)
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 个评论
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