Taking the nearest decimals possible
5 ビュー (過去 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 で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!