%% Write Cell Array to Text File
% Create a cell array, write it to a comma-separated text file, and then write the cell array to another text file with a different delimiter character.
% Create a simple cell array in the workspace.

C =  {1,2,3;
     'text',datetime('today'),hours(1)}

% Write the cell array to a comma delimited text file and display the file contents. The writecell function outputs a text file named C.txt.

writecell(C)
type 'C.txt'

% To write the same cell array to a text file with a different delimiter character, use the 'Delimiter' name-value pair.

writecell(C,'C_tab.txt','Delimiter','tab')
type 'C_tab.txt'

% Copyright 2018 The MathWorks, Inc.