i want a programme to approximate decimal to number
10 views (last 30 days)
Show older comments
i want a programme to approximate decimal to number
EX:
if I have 2.1 or 2.3 or 2.3 or 2.4
I want the answer to be 2
and if i have 2.5 till to 2.9
I want the answer to be 3
but the number is variable
I mean (2) can be 1,2,3,4,.....and so on
any number i can enter it
0 Comments
Accepted Answer
the cyclist
on 29 Apr 2013
Edited: the cyclist
on 29 Apr 2013
Do you just need the round() function?
>> round(2.3)
ans =
2
10 Comments
Jan
on 29 Apr 2013
@Karim: Here the code is saved to a "function". The Getting Started chapters of the documentation explain the using of functions exhaustively, such that it is recommended to read them. It is not the job of the forum to repeat the basics, when all required information are found in the docs already.
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!