Having a string call another string

2 vues (au cours des 30 derniers jours)
Zachary
Zachary le 17 Juin 2024
Commenté : Stephen23 le 17 Juin 2024
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");

Réponses (1)

Stephen23
Stephen23 le 17 Juin 2024
Déplacé(e) : dpb le 17 Juin 2024
txt = input("Enter your string: ","s");
disp("Your string was: " + txt)
  2 commentaires
Zachary
Zachary le 17 Juin 2024
Déplacé(e) : Stephen23 le 17 Juin 2024
Thank you so much!
Stephen23
Stephen23 le 17 Juin 2024
@Zachary: please remember to click the accept button for answers that helped you!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Characters and Strings dans Help Center et File Exchange

Tags

Produits


Version

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by