Taking the nearest decimals possible
1 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a query
i have 2 number
1] 1.6778
2] 2.032
How do i take the number 1.6778 to 1.7 ( nearest value)
and 2.032 to 2.0 ?
Kindly help
0 个评论
采纳的回答
Adam Danz
2020-4-22
编辑:Adam Danz
2020-4-22
Y = round(X,N) where N is the number of digits to the right (when positive) or left (negative).
Alternativly,
y = round(X*10)/10;
3 个评论
Stephen23
2020-4-23
Either ismembertol or do it yourself by comparing the absolute difference against a tolerance limit:
abs(A-B)<tol
更多回答(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!