File Exchange

image thumbnail

Insert commas into numbers

version (1.16 KB) by Jack Peterson
Insert commas into numbers.

1 Download

Updated 03 Jun 2013

View Version History

View License

Insert commas into numbers, e.g. 1234567 -> '1,234,567'.

Cite As

Jack Peterson (2020). Insert commas into numbers (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (1)


A faster loop-free approach wich considers a fractional part also:
S = sprintf('%.16g', pi * 1e12);
S(2, strfind(S, '.') - 4:-3:1) = ',';
S = transpose(S(S ~= char(0)));

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

Community Treasure Hunt

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

Start Hunting!