All pastes #804836 Raw Edit

Stuff

public text v1 · immutable
·published 2007-12-03 20:40 UTC
rendered paste body
function s = DigitGroup(n)
  nLength = ceil(log(n)/log(10));
  
  if nLength < 3
    s = sprintf('%d', n);
  else
    s = [DigitGroup(floor(n/1000)) ',' sprintf('%d',mod(n,1000))];
  end
end