%% Write Timetable to Text File
% Create a timetable, write it to a comma-separated text file, and then write the timetable to another text file with a different delimiter character.
% Define a timetable in the workspace with row times duration vector RowTimes.

RowTimes = seconds(1:5)';
TT = timetable(RowTimes,[98;97.5;97.9;98.1;97.9],[120;111;119;117;116],...
               'VariableNames',{'Reading1','Reading2'})

% Write the timetable to a comma delimited text file and display the file contents. The writetimetable function outputs a text file named TT.txt.

writetimetable(TT)
type 'TT.txt'

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

writetimetable(TT,'TT_bar.txt','Delimiter','bar')
type 'TT_bar.txt'

% Copyright 2018 The MathWorks, Inc.