Problem 2866. Matlab Basics - Rounding II
Write a script to round a variable x to 3 decimal places:
e.g. x = 2.3456 --> y = 2.346
Solution Stats
Problem Comments
-
3 Comments
Alireza yarmohammadi
on 19 Mar 2021
nice
but this problem is not in 2013 and downer versions
arsenic 陈
on 29 Mar 2021
answer:y = round(x,3)
why roundn not work?
goc3
on 29 Mar 2021
@arsenic 陈: roundn is a toolbox function. Cody only supports functions in basic MATLAB.
Solution Comments
Show commentsProblem Recent Solvers4853
Suggested Problems
-
Replace NaNs with the number that appears to its left in the row.
3008 Solvers
-
Generate N equally spaced intervals between -L and L
875 Solvers
-
Given a matrix, swap the 2nd & 3rd columns
1100 Solvers
-
366 Solvers
-
964 Solvers
More from this Author28
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!