displaying text before answer

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.

답변 (2개)

Walter Roberson
Walter Roberson 2019년 11월 10일
편집: Walter Roberson 2019년 11월 10일

0 개 추천

Use fprintf() using a format that does not end in \n if you want to display something without going to the next line after.
Sarvesh Kale
Sarvesh Kale 2023년 3월 9일

0 개 추천

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
The value of pi is 3.140000
I hope this helps

카테고리

도움말 센터File Exchange에서 Desktop에 대해 자세히 알아보기

태그

질문:

2019년 11월 10일

답변:

2023년 3월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by