print decimal and whole numbers as they are with right justification
6 ビュー (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
回答 (1 件)
Stephen23
2017 年 11 月 29 日
>> fprintf('%10g\n',a)
0.2569
1.7856
16.2451
485.541
0.21
50
2 件のコメント
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 Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!