displaying text before answer
Mostrar comentarios más antiguos
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.
Respuestas (2)
Walter Roberson
el 10 de Nov. de 2019
Editada: Walter Roberson
el 10 de Nov. de 2019
0 votos
Use fprintf() using a format that does not end in \n if you want to display something without going to the next line after.
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
Categorías
Más información sobre Desktop en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!