Clean Timetable with Missing, Duplicate, or Nonuniform Times
This example shows how to create a regular timetable from one that has missing, duplicate, or
nonuniform times. A timetable is a type of table that associates a time-stamp, or row time, with each
row of data. In a regular timetable, the row times are sorted and unique, and differ by the same
regular time step.
Also, some toolboxes have functions that work on regularly spaced time series data in the form of
numeric arrays. So the example also shows how to export the data from a timetable for use with other
functions.
There are a number of issues with row times that can make timetables irregular. The row times can
be missing. They can be out of order. They can be duplicates, creating multiple rows with the same
time that might have the same or different data. And even when they are present, sorted, and unique,
they can differ by time steps of different sizes.
Timetables provide a number of different ways to resolve missing, duplicate, or nonuniform times,
and to resample or aggregate data to create regular row times.
• To find missing row times, use ismissing.
• To remove missing times and data, use rmmissing.
• To sort a timetable by its row times, use sortrows.
• To make a timetable with unique and sorted row times, use unique and retime.
• To remove duplicate times, specify a vector of unique times and use retime.
• To make a regular timetable, specify a regular time vector and use retime.
Clean Timetable with Missing, Duplicate, or Nonuniform Times
10-27
This example shows how to create a regular timetable from one that has missing, duplicate, or
nonuniform times. A timetable is a type of table that associates a time-stamp, or row time, with each
row of data. In a regular timetable, the row times are sorted and unique, and differ by the same
regular time step.
Also, some toolboxes have functions that work on regularly spaced time series data in the form of
numeric arrays. So the example also shows how to export the data from a timetable for use with other
functions.
There are a number of issues with row times that can make timetables irregular. The row times can
be missing. They can be out of order. They can be duplicates, creating multiple rows with the same
time that might have the same or different data. And even when they are present, sorted, and unique,
they can differ by time steps of different sizes.
Timetables provide a number of different ways to resolve missing, duplicate, or nonuniform times,
and to resample or aggregate data to create regular row times.
• To find missing row times, use ismissing.
• To remove missing times and data, use rmmissing.
• To sort a timetable by its row times, use sortrows.
• To make a timetable with unique and sorted row times, use unique and retime.
• To remove duplicate times, specify a vector of unique times and use retime.
• To make a regular timetable, specify a regular time vector and use retime.
Clean Timetable with Missing, Duplicate, or Nonuniform Times
10-27
