joining integer ans decimal part of number
3 ビュー (過去 30 日間)
古いコメントを表示
I have 2 numbers say 100 and 0.025 and I want to print them as 100.025, how this could be done?
0 件のコメント
回答 (1 件)
Star Strider
2018 年 8 月 29 日
The easiest way is to just add them:
n1 = 100
n2 = 0.025
N = n1+n2
To print them:
sprintf('%.3f', n1+n2)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Numeric Types についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!