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?

回答(1 个)

Star Strider
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)

类别

Help CenterFile Exchange 中查找有关 Multirate Signal Processing 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by