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

    %% Specify Formatting  
% Specify the width, precision, and other formatting for an array of floating-point
% values.   

% Copyright 2015 The MathWorks, Inc.


%%  
A = gallery('uniformdata',[2,3],0) * 9999;
s = num2str(A,'%10.5e\n')

%%
% The format |'%10.5e'| prints each value in exponential format with five
% decimal places, and |'\n'| prints a new line character.