How can I format some numbers and pad them with zeros?
8 ビュー (過去 30 日間)
古いコメントを表示
I have a data set where I have columns of data in the following format.
98.23
98.36
78.255
100.56
I basically want to have it cut off 2 digits after the decimal and pad with zeros in the front.
Example:
098.23
098.36
078.25
100.56
I've tried '%3.3f\n but I can't get the zero padding to work. Please help and thank you! :)
0 件のコメント
採用された回答
Azzi Abdelmalek
2016 年 6 月 10 日
編集済み: Azzi Abdelmalek
2016 年 6 月 10 日
A=[8.23
98.36
78.255
100.56]
B=sprintf('%06.2f\n',A)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!