round off to nearest 5 instead of 10
68 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
is that any way to round off to nearest 5 instead of 10? for example, round off 346 to 345; 293 to 295; 296 to 295;
thx for help :p
3 Kommentare
John D'Errico
am 4 Okt. 2020
@Aiman Waheed:
Use round. READ THE HELP FOR ROUND. Unless you have an old release of MATLAB, round has allowed you to round to any number of digits for some years now.
Note that you cannot round to an EXACT decimal, since MATLAB does not store numbers in a decimal form.
Akzeptierte Antwort
Adam
am 9 Dez. 2014
Bearbeitet: Adam
am 9 Dez. 2014
round( x / 5 ) * 5;
2 Kommentare
Adam
am 9 Dez. 2014
Well, it isn't always easy. I asked a question on creating a matrix to which the answer provided by Rick Rosson was similarly trivial a few months ago, but only if your thought process takes you in that direction!
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!