array2timetable
Convert homogeneous array to timetable
Syntax
Description
converts an input array to a timetable. The input array TT = array2timetable(X,'RowTimes',rowTimes)X is an
M-by-N array and the vector
rowTimes is an M-by-1
vector of datetime or duration values. Each column of X becomes a
variable of TT. The time values in rowTimes
label the rows of the timetable. TT is an
M-by-N timetable.
For more information on creating and using timetables, see Timetables.
creates a timetable from an array, T = array2timetable(X,Name,Value)X, with additional options
specified by one or more Name,Value pair arguments.
For example, you can specify variable names to include in the timetable.
Examples
Input Arguments
Name-Value Arguments
Output Arguments
Tips
In certain cases, you can call
array2timetablewith a syntax that specifies a regular time step between row times, and yetarray2timetablereturns an irregular timetable. This result occurs when you specify the time step using a calendar unit of time and there is a row time that introduces an irregular step. For example, if you create a timetable with a time step of one calendar month, starting on January 31, 2019, then it is irregular with respect to months.stime = datetime(2019,1,31); tstep = calmonths(1); X = [1:3]'; TT = array2timetable(X,'TimeStep',tstep,'StartTime',stime)
TT = 3×1 timetable Time X ___________ _ 31-Jan-2019 1 28-Feb-2019 2 31-Mar-2019 3There are other cases where irregularities are due to shifts from Daylight Saving Time (DST) or to
datetimevalues that are leap seconds. This table specifies the dates, times, and time steps that can produce irregular results unexpectedly.Row Time Value
Time Step
Start time specified as the 29th, 30th, or 31st day of the month.
Number of calendar months or quarters.
Start time specified as February 29.
Number of calendar years.
Any datetimevalue occurring between 1:00 a.m. and 2:00 a.m. on a day shifting from DST to standard time (when such values have a time zone that observes DST).Number of calendar days or months. Any
datetimevalue that is a leap second (when the time zone for such values is theUTCLeapSecondstime zone). For the list of leap seconds, seeleapseconds.Time step specified in any calendar unit (days, weeks, months, quarters, or years).
Extended Capabilities
Version History
Introduced in R2016bSee Also
table2timetable | timetable | isvarname | summary | uitable