File Exchange

image thumbnail

Insert commas into numbers

version 1.1 (1.16 KB) by

Insert commas into numbers.

2 Downloads

Updated

View License

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

Comments and Ratings (1)

Jan Simon

Jan Simon (view profile)

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)));

Updates

1.1

Fixed leading commas

MATLAB Release
MATLAB 7.12 (R2011a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video