writetimetable
Write timetable to file
Description
writetimetable( writes the timetable
TT)TT to a comma-delimited text file. The file name is the workspace
variable name of the timetable, appended with the extension .txt. If
writetimetable cannot construct the file name from the input timetable
name, then it writes to the file timetable.txt.
Each column of each variable in TT becomes a column in the output
file. The variable names of TT become column headings in the first line
of the file. The writetimetable function overwrites any existing
file.
writetimetable(
writes to a file with the name and extension specified by
TT,filename)filename.
writetimetable determines the file format based on the specified
extension. The extension must be one of the following:
.txt,.dat, or.csvfor delimited text files.xls,.xlsm, or.xlsxfor Excel® spreadsheet files.xlsbfor Excel spreadsheet files supported on systems with Excel for Windows®.xmlfor Extensible Markup Language (XML) files.
writetimetable(___,
uses additional options specified by one or more Name,Value)Name,Value pair
arguments and can include any of the input arguments in previous syntaxes.
For example, you can specify whether to write the variable names as column headings in the output file.
Examples
Input Arguments
Name-Value Arguments
Algorithms
There are some instances where the
writetimetablefunction creates a file that does not represent the input data exactly. You will notice this when you use thereadtimetablefunction to read that file. The resulting data might not have the exact same format or contents as the original data. If you need to save your timetable and retrieve it at a later time to exactly match the original timetable, with the same data and organization, then save it as a MAT-file.writetimetablewrites an inexact table in the following instances:writetimetablewrites out numeric data usinglong gformat, and categorical or character data as unquoted text.writetimetablewrites out variables that have more than two dimensions as two dimensional variables, with the trailing dimensions collapsed.For cell-valued variables,
writetimetablewrites out the variables differently based on the data type of the content in the cells.If the content of the cell is of the data type numeric, text, logical, categorical, datetime, or duration, then the
writetimetablefunction writes out the contents of each cell as a single row, in multiple, delimiter-separated fields.Otherwise, the
writetimetablefunction writes out a single empty field.
Excel converts
Infvalues to65535. MATLAB® convertsNaN,NaT,<undefined>categorical values, and<missing>string values to empty cells.
Version History
Introduced in R2019a