truncate and floating-points
Show older comments
I need to write a function called truncate that takes a floating-point value as its input and truncates (discards) the value after a specified decimal point before returning the modified floating-point value. It should be possible to call your function from the command window using the following: >> res = truncate(5.672, 2); % results in res = 5.67 >> res = truncate(5.677, 2); % results in res = 5.67 >> res = truncate(-5.672, 2); % results in res = -5.67 >> res = truncate(-5.677, 2); % results in res = -5.67
thanks!
Answers (2)
Roger Stafford
on 28 Feb 2014
1 vote
Yes, it can be "fixed" to accomplish that.
Walter Roberson
on 28 Feb 2014
0 votes
Categories
Find more on Subplots 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!