When I have a string variable, how can I make a fprintf display the entire string in one output?
조회 수: 4 (최근 30일)
이전 댓글 표시
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
채택된 답변
Image Analyst
2023년 2월 17일
Try %s instead of %c:
pool = input("Name of the pool wanted:\n",'s');
fprintf("Name of the pool requested: %s\n",pool)
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!