www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/SpecifyFieldWidthofaPrintedValueExample.m

    %% 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.