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일

1 개 추천

txt = input("Enter your string: ","s");
disp("Your string was: " + txt)

댓글 수: 2

Zachary
Zachary 2024년 6월 17일
이동: Stephen23 2024년 6월 17일
Thank you so much!
Stephen23
Stephen23 2024년 6월 17일
@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