Prompt user for a text string
953 ビュー (過去 30 日間)
古いコメントを表示
This keeps coming up as an error, what am I doing wrong?
prompt= 'State your name, Your Grace ';
name=input(prompt);
0 件のコメント
採用された回答
Chad Greene
2015 年 11 月 8 日
I think you want
name=input(prompt,'s');
to specify a string.
2 件のコメント
Joseph Armstrong
2020 年 12 月 11 日
Thanks been trying to solve this 's' needed to be in thanks so much
その他の回答 (1 件)
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
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
2021 年 6 月 24 日
I do not see how that code is a solution to any topic that was being discussed here?
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!