Significant Figures

Workaround for fprintf/sprintf to produce correct output for signficant figures, as fprintf/sprintf

Download
Download

You are now following this Submission

Cite As

Teck Por Lim (2026). Significant Figures (https://www.mathworks.com/matlabcentral/fileexchange/10669-significant-figures), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.8.0

Support for Inf and -Inf

Download
1.6.0

Allowed default nargin < 2 to mean number of significant figures = 3
Updated example.m

Download
1.5.0

Updated description.

Download
1.4.0

Fixed bug with sigfig(99.9999,2).
Removed leading zeros from exponent.

Download
1.3.0

Bug fixed.

Download
1.0.0

To enable sigfig(nan)

Download