Taking the nearest decimals possible
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Adam Danz
le 22 Avr 2020
Modifié(e) : Adam Danz
le 22 Avr 2020
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 commentaires
Stephen23
le 23 Avr 2020
Either ismembertol or do it yourself by comparing the absolute difference against a tolerance limit:
abs(A-B)<tol
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!