Round to a Specified Number of Significant Digits

version (5.42 KB) by Edward Zechmann
Rounds a numeric array to a specified number of Significant Digits. Supports real and complex numbers, five different kinds of rounding.


Updated 26 Mar 2022

View License

sd_round stands for "Significant Digits Round".
This program rounds a 2-d matrix of numbers to a specified number of significant digits.
This program support five different styles of rounding the last digit: to the nearest integer, up, down, toward zero, and away from zero.
This program supports real and complex numbers.
This program supports units and a three digit separator character.
The program outputs the rounded array, a cell string of the rounded matrix, the number of digits, to the left and right of the decimal place.
This program is useful for presenting scientific data that requires rounding to a specified number of significant digits for publication.

Cite As

Edward Zechmann (2022). Round to a Specified Number of Significant Digits (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2007b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: round2, FIX2, ROUND2

Inspired: Round with significant digits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!