%% Specify Field Width of a Printed Value
% Specify the minimum width of the printed value.

str = sprintf('%025d',[123456])

% The 0 flag in the %025d format specifier requests leading zeros in the output.
% Copyright 2012 The MathWorks, Inc.