fprintf for command window

trying to Create output for the command window using fprintf " using matlab 2018b"
x = 2;
y = 4;
z = 7;
h = 9;
sol1 = x + h
sol2 = z/h
sol3 = y*cos(z)
sol4 = sqrt(h)*(z)^2
sol5 = abs(-x)/log(y)
fprintf('%s%4i\n',' Addition: ',A)
fprintf( )

2 comentarios

Walter Roberson
Walter Roberson el 27 de En. de 2019
I don't see an assignment to a variable A and if it is intended to be a function with no inputs, it would sure help to see the code for it...

Iniciar sesión para comentar.

Respuestas (1)

madhan ravi
madhan ravi el 28 de En. de 2019

0 votos

A=[1:5;[sol1 sol2 sol3 sol4 sol5]];
fprintf('Solution %d: %.2f\n',A)

Categorías

Más información sobre Functions en Centro de ayuda y File Exchange.

Productos

Versión

R2018b

Etiquetas

Preguntada:

el 27 de En. de 2019

Comentada:

el 28 de En. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by