Code covered by the BSD License

### Highlights from Round to Specified Digits Place

3.33333
3.3 | 3 ratings Rate this file 12 Downloads (last 30 days) File Size: 3.62 KB File ID: #21121 Version: 1.0

# Round to Specified Digits Place

### Edward Zechmann (view profile)

18 Aug 2008 (Updated )

Rounds to the specified digits place and supports five different styles of rounding the last digit.

File Information
Description

This program is similar to round2. It supports both real and complex numbers. It rounds to the specified digits place and it supports five different styles of rounding the last digit. Also the last digit can be rounded to a multiple of a whole number.

This program also converts the precision rounded array to a cell array of strings.

The program is especially useful for scientific publications, where rounding to a specified digits place is necessary.

Acknowledgements

Round2 and Round2 inspired this file.

This file inspired Rounding Functions Collection And Cheat Sheet.

MATLAB release MATLAB 7.5 (R2007b)
02 May 2014 Chris Patterson

### Chris Patterson (view profile)

I found this file to be better:

http://www.mathworks.nl/matlabcentral/fileexchange/26212-round-with-significant-digits

13 May 2013 Will

### Will (view profile)

18 Apr 2012 Edward Zechmann

### Edward Zechmann (view profile)

Roundn is in the Mapping Toolbox which costs approximately \$1,000.00 for a single user license. It is much simpler; however, it has fewer features and costs \$1,000.00. The syntax for using roundn is reproduced from the Mathworks website to help anyone who reads this comment thread. Please let me know if a program with the simple syntax of Roundn would be of benefit to the Matlab Central Users Community.

roundn - Round to multiple of 10n
Syntax

roundn(x,n)
Description

roundn(x,n) rounds each element of x to the nearest multiple of 10n. The variable n must be scalar, and integer-valued. For complex x, the imaginary and real parts are rounded independently. For n = 0, roundn gives the same result as round. That is, roundn(x,0) == round(x).

Comment only
06 Apr 2012 Humayun Kathuria

### Humayun Kathuria (view profile)

Guys! Use "roundn" if you want to use a simple MATLAB built-in function.

19 Aug 2008 Duane Hanselman

Too bad the help text lacks an H1 line and is entirely different than standard MATLAB help text. Otherwise, this might be a good submission.

Comment only