%% 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')

% Copyright 2012 The MathWorks, Inc.