print decimal and whole numbers as they are with right justification

6 Ansichten (letzte 30 Tage)
deb.P
deb.P am 29 Nov. 2017
Kommentiert: Stephen23 am 29 Nov. 2017
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.

Antworten (1)

Stephen23
Stephen23 am 29 Nov. 2017
>> fprintf('%10g\n',a)
0.2569
1.7856
16.2451
485.541
0.21
50
  2 Kommentare
Stephen23
Stephen23 am 29 Nov. 2017
@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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by