Convert homogeneous array to timetable
converts TT
= array2timetable(X
,'RowTimes',rowTimes
)X
and rowTimes
to a timetable.
X
is an M
-by-N
array
and 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.
In certain cases, you can call array2timetable
with a syntax
that specifies a regular time step between row times, and yet
array2timetable
returns 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 3
There are other cases where irregularities are due to shifts from Daylight Saving Time (DST) or to row times that are leap seconds. This table specifies the row time values and time steps that can produce irregular timetables 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 row time occurring between 1:00 a.m. and 2:00 a.m. on a day shifting from DST to standard time (when row times are specified as datetime values whose time zone observes DST). | Number of calendar days or months. |
Any row time that is a leap second (when row times are specified as
datetime values whose time zone is the | Time step specified in any calendar unit (days, weeks, months, quarters, or years). |
isvarname
| summary
| table2timetable
| timetable
| uitable