Rounding Off Number(s) to Specified Significant Figures
spa_sf Rounding Off Number(s) to Certain Significant Figures
N = spa_sf(X,SF) is the rounded off number(s) of X with the specified significant figures SF. X could be a scalar or a vector; however, SF must be a scalar.
Example 1)
X = 3.14159265359;
SF = 3;
N = spa_sf(X,SF)
> N = 3.1400
Example 2)
X = 3.14159265359; X=[X,X*2;X*3,X*4];
SF = 3;
N = spa_sf(X,SF)
> N =
3.1400 6.2800
9.4200 12.6000
See also: num2str, str2num
* I hope it would be of any help.
Cite As
Yuzo Toya (2024). Rounding Off Number(s) to Specified Significant Figures (https://www.mathworks.com/matlabcentral/fileexchange/23949-rounding-off-number-s-to-specified-significant-figures), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |