joining integer ans decimal part of number
2 次查看(过去 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 中查找有关 Multirate Signal Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!