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

    %% Write Data and Specify Precision  

%% 
% Create an array of sample numeric data. 
M = magic(3);  

%% 
% Export matrix |M| to a file using a precision of 6 decimal places. 
dlmwrite('myFile.txt',M,'precision','%.6f');  

%% 
% View the data in the file. 
type('myFile.txt')