%% Write Comma-Separated Data
% Create an array of sample data, M.

M = magic(3);

%
% Write matrix M to a file myFile.txt.

dlmwrite('myFile.txt',M)

%
% View the data in the file.

type('myFile.txt')

% Copyright 2012 The MathWorks, Inc.