Taking the nearest decimals possible
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Ganesh Kini
am 22 Apr. 2020
Kommentiert: Stephen23
am 23 Apr. 2020
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 Kommentare
Akzeptierte Antwort
Adam Danz
am 22 Apr. 2020
Bearbeitet: Adam Danz
am 22 Apr. 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 Kommentare
Stephen23
am 23 Apr. 2020
Either ismembertol or do it yourself by comparing the absolute difference against a tolerance limit:
abs(A-B)<tol
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!