sprintf for 3.1901 to show 03.190
1 回表示 (過去 30 日間)
古いコメントを表示
I have the numbers
s = 3.1901
and
ss = 13.1905
and want to use
sprintf(formatSpec, s) and sprintf(formatSpec, ss)
to return
03.190 {i.e. rounded to 3DP and the leading zero shown}
and
13.191 {i.e. rounded to 3DP}
so both 3.1901 and 13.1905 should return
2 places before the DP (leading zero for 3.1901)
and
3 places after the DP (rounded to 3 DP)
I am struggling to figure out the correct formatSpec when calling sprintf(formatSpec, ....)
0 件のコメント
採用された回答
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Whos についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!