print decimal and whole numbers as they are with right justification

조회 수: 6 (최근 30일)
deb.P
deb.P 2017년 11월 29일
댓글: Stephen23 2017년 11월 29일
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.

답변 (1개)

Stephen23
Stephen23 2017년 11월 29일
>> fprintf('%10g\n',a)
0.2569
1.7856
16.2451
485.541
0.21
50
  댓글 수: 2
Stephen23
Stephen23 2017년 11월 29일
@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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by