%% Write Table to Text File
% Create a table.

T = table(['M';'F';'M'],[45 45;41 32;40 34],...
    {'NY';'CA';'MA'},[true;false;false])

%
% Write the table to a comma delimited text file and display the file contents.

writetable(T)

% writetable outputs a text file named T.txt.
%

type 'T.txt'

% writetable appends a unique suffix to the variable name, Var2, above the two columns of corresponding data.
% Copyright 2015 The MathWorks, Inc.