displaying text before answer
조회 수: 27 (최근 30일)
이전 댓글 표시
So I made a function on matlab but i want matlab to display 'the answer is' text and then the answer . How am I suppose to do that? I think I have to use disp code but I couldn't figure how.
댓글 수: 0
답변 (2개)
Walter Roberson
2019년 11월 10일
편집: Walter Roberson
2019년 11월 10일
Use fprintf() using a format that does not end in \n if you want to display something without going to the next line after.
댓글 수: 0
Sarvesh Kale
2023년 3월 9일
refer to the following code
x = 3.14 ;
fprintf("The value of pi is %f \n",x); % this will print the answer in your required format
I hope this helps
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!