print decimal and whole numbers as they are with right justification

i want to print this vector a = [0.2569; 1.7856; 16.2451; 485.5412; 0.21; 50] as follows: a =
0.2569
1.7856
16.2451
485.5412
0.21
50
i want to print them with right justification irrespective of placement of decimal point.

Respuestas (1)

>> fprintf('%10g\n',a)
0.2569
1.7856
16.2451
485.541
0.21
50

2 comentarios

thank you
@deb.P: I hope that it helps. Remember to accept the answer that help resolve your question. Accepting answers is the easiest way to show your thanks to the volunteers who helped you.

Iniciar sesión para comentar.

Categorías

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

Etiquetas

Preguntada:

el 29 de Nov. de 2017

Comentada:

el 29 de Nov. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by