When I have a string variable, how can I make a fprintf display the entire string in one output?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Steven
am 17 Feb. 2023
Beantwortet: Image Analyst
am 17 Feb. 2023
When I run the code at the bottom as part of a larger code, the output I get is something like:
-Name of the pool requested: R
-Name of the pool requested: a
-Name of the pool requested: m
-Name of the pool requested: p
If I put Ramp as the input. If I want the fprintf to display:
-Name of the pool requested: Ramp
How can I get it to do that?
pool = input("Name of the pool wanted:\n",'s');
fprintf("Name of the pool requested: %c\n",pool)
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 17 Feb. 2023
Try %s instead of %c:
pool = input("Name of the pool wanted:\n",'s');
fprintf("Name of the pool requested: %s\n",pool)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!