Having a string call another string

Hello everyone,
I'm new to matlab and learning it right now.
I was wondering how I would make a string that would prompt the user for an input statement and would output the statment exactly as shown (Your string was: 'hi there').
Enter your string: hi there
Your string was: ‘hi there’
Here is what I have so far and i've tried multiple different ways and cant seem to figure out how to call it back.
txt = input('Enter your string: ',"s");

回答(1 个)

Stephen23
Stephen23 2024-6-17
移动:dpb 2024-6-17
txt = input("Enter your string: ","s");
disp("Your string was: " + txt)

2 个评论

Thank you so much!
@Zachary: please remember to click the accept button for answers that helped you!

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Characters and Strings 的更多信息

产品

版本

R2024a

标签

提问:

2024-6-17

评论:

2024-6-17

Community Treasure Hunt

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

Start Hunting!

Translated by