In *|R2014b|*, the *|round|* function now supports rounding to a specific number of digits:
minval = 0.4410;
maxval = 0.8450;
r1_minval = round(minval, 1);
r1_maxval = round(maxval, 1);
If you don’t have *|R2014b|*, this works:
diground = @(x,d) round(x*10^d)/10^d;
r2_minval = diground(minval,1);
r2_maxval = diground(maxval,1); Answer from Star Strider on mathworks.com
MathWorks
mathworks.com › matlab › mathematics › elementary math › arithmetic operations
round - Round to nearest decimal or integer - MATLAB
This MATLAB function rounds each element of X to the nearest integer.
Videos
MATLAB: Rounding Functions (round down) - floor - YouTube
MATLAB: Rounding Functions - round - YouTube
MATLAB: Rounding Functions (round toward zero) - fix - YouTube
06:21
Master MATLAB Rounding Functions: Round, Ceil, Fix, and Floor - ...
MATLAB: Rounding Functions (round up) - ceil - YouTube
MathWorks
mathworks.com › matlabcentral › answers › 1887462-how-do-you-round-up-or-down-to-a-decimal
How do you round up or down to a decimal - MATLAB Answers - MATLAB Central
January 2, 2023 - Rereading the matlab documentation, tiebreaker is only for the exact midpoint. So there is no round up or round down. This does not solve my problem.
MathWorks
mathworks.com › matlab › mathematics › elementary math › arithmetic operations
ceil - Round toward positive infinity - MATLAB
This MATLAB function rounds each element of X to the nearest integer greater than or equal to that element.
Top answer 1 of 4
5
Wikipedia knows:
round(X): round to nearest integer, trailing 5 rounds to the nearest integer away from zero. For example, round(2.5) returns 3; round(-2.5) returns -3.
There's a little more information on this scheme (Round half away from zero), and many others, in the article on rounding.
2 of 4
4
>> round([-0.5 0.5])
ans =
-1 1
MathWorks
mathworks.com › matlabcentral › answers › 309097-how-to-round-up-to-closest-0-or-5-in-array
How to round up to closest 0 or 5 in array? - MATLAB Answers - MATLAB Central
October 25, 2016 - Now, I do for instance this 1 `utp = utp * 1000; utp = round(utp/5)*; utp = utp / 1000;` to get dimensions match in cases where integers are not significant. Maybe, just add a notification that it is designed for integers is the best option here. Sign in to comment. Sign in to answer this question. Find more on Logical in Help Center and File Exchange ... Find the treasures in MATLAB Central and discover how the community can help you!
MathWorks
mathworks.com › matlab › mathematics › elementary math › arithmetic operations
floor - Round toward negative infinity - MATLAB
This MATLAB function rounds each element of X to the nearest integer less than or equal to that element.
MathWorks
mathworks.com › mapping toolbox › geometric geodesy › lengths and angles
roundn - (Not recommended) Round to multiple of 10n - MATLAB
Y = roundn(X,n) rounds each element of X to the nearest multiple of 10n.
MathWorks
mathworks.com › fixed-point designer › data type exploration › fixed-point specification › fixed-point specification in matlab › fixed-point math functions
round - Round fi object toward nearest integer or round input data using quantizer object - MATLAB
This MATLAB function rounds fi object a to the nearest integer.
MathWorks
mathworks.com › matlabcentral › answers › 1571238-round-all-values-in-table
Round all values in table - MATLAB Answers - MATLAB Central
October 25, 2021 - However, variables not selected by the @isnumeric will simply not appear in the output table, and the variables that do appear will have 'round_' as a prefix. This is not exactly the most convenient for post-processing. Another approach is to create a helper function along the lines of ... Thanks very much, I had no idea about the InputVariables option to varfun(), something I definitely could have used in the past! ... The other method, whilst also good, for me coming up with that regex pattern is still a mental speedbump.
MathWorks
mathworks.com › matlabcentral › answers › 623643-how-to-round-up-to-1-decimal-value
How to round UP to 1 decimal value? - MATLAB Answers - MATLAB Central
October 23, 2020 - Suppose I have a value x = 6.543. I want to round it up to 6.6. I tried x = 6.543; x_round = round(x,1); But it always returns x_round=6.5 Thanks in advance!