fprintf for multiple variables

29 visualizaciones (últimos 30 días)
Donghun
Donghun el 22 de Nov. de 2022
Comentada: Donghun el 22 de Nov. de 2022
a = 3;
b = [2 3; 1 5];
fprintf('The number: %d\n The points: %6.1f %12.1f\n', a, b);
Hi, I would like to ask how I can print multiple variables using fprintf.
What I want to show is
The number: 3
The points: (2, 3), (1,5)
Thank you for your time!

Respuesta aceptada

Stephen23
Stephen23 el 22 de Nov. de 2022
a = 3;
b = [2,3;1,5];
fprintf('The number: %d\nThe points: (%d,%d) (%d,%d)\n', a, b.');
The number: 3 The points: (2,3) (1,5)
  1 comentario
Donghun
Donghun el 22 de Nov. de 2022
Thank you very much!!
It perfectly works.
I appreciate it.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by