%!demo
%! ## `writetable` writes a table in a **MATLAB-interoperable** format — a plain
%! ## header row of variable names followed by the data, with no package-specific
%! ## metadata.  The file type follows the extension; `'Delimiter'` sets the
%! ## separator for text files.
%!
%! T = table ([38; 43; 40], [71; 69; 64], 'VariableNames', {'Age', 'Height'})
%! filename = fullfile (tempdir (), 'patients.txt');
%! writetable (T, filename, 'Delimiter', 'tab');
%! type (filename)
%!
%! delete (filename);

%!demo
%! ## For spreadsheets, choose the target `'Sheet'` and, with `'WriteRowNames'`,
%! ## emit the row names as the leading column — `readtable` reads it straight back.
%!
%! T = table ([38; 43], [71; 69], 'VariableNames', {'Age', 'Height'}, ...
%!            'RowNames', {'Li', 'Diaz'})
%! filename = fullfile (tempdir (), 'patients.ods');
%! writetable (T, filename, 'Sheet', 'Cohort', 'WriteRowNames', true);
%! readtable (filename, 'Sheet', 'Cohort', 'ReadRowNames', true)
%!
%! delete (filename);
