00:00:00
00:00:00
00:00:00
01:04:47
00:00:00
00:00:00
Since the row times are sorted, this result shows that some row times are unique and some are
duplicates.
Remove Duplicate Rows
Timetables can have duplicate rows. Timetable rows are duplicates if they have the same row times
and the same data values. In this example, the last two rows of sortedTT are duplicate rows. (There
are other rows in sortedTT that have duplicate row times but differing data values.)
To remove the duplicate rows from sortedTT, use unique. The unique function returns the unique
rows and sorts them by their row times.
uniqueRowsTT = unique(sortedTT)
uniqueRowsTT=9×3 timetable
Time
Temp
Rain
WindSpeed
____________________
____
____
_________
09-Jun-2016 05:03:11
66.2
0.05
3
09-Jun-2016 06:01:04
73
0.01
2.3
09-Jun-2016 07:59:23
59
0.08
0.9
09-Jun-2016 08:49:10
62
0.01
2.7
09-Jun-2016 08:49:10
67.2
0.01
2.7
09-Jun-2016 08:49:10
75.8
0.01
2.7
09-Jun-2016 08:49:10
82
0.01
2.7
09-Jun-2016 09:53:57
59
0.03
3.4
09-Jun-2016 09:53:57
67
0.03
3.4
Find Rows with Duplicate Times and Different Data
Timetables can have rows with duplicate row times but different data values. In this example,
uniqueRowsTT has several rows with the same row times but different values.
Find the rows that have duplicate row times. First, sort the row times and find consecutive times that
have no difference between them. Times with no difference between them are the duplicates. Index
back into the vector of row times and return a unique set of times that identify the duplicate row
times in uniqueRowsTT.
dupTimes = sort(uniqueRowsTT.Time);
tf = (diff(dupTimes) == 0);
dupTimes = dupTimes(tf);
dupTimes = unique(dupTimes)
dupTimes = 2x1 datetime
09-Jun-2016 08:49:10
09-Jun-2016 09:53:57
Clean Timetable with Missing, Duplicate, or Nonuniform Times
10-31
00:00:00
00:00:00
01:04:47
00:00:00
00:00:00
Since the row times are sorted, this result shows that some row times are unique and some are
duplicates.
Remove Duplicate Rows
Timetables can have duplicate rows. Timetable rows are duplicates if they have the same row times
and the same data values. In this example, the last two rows of sortedTT are duplicate rows. (There
are other rows in sortedTT that have duplicate row times but differing data values.)
To remove the duplicate rows from sortedTT, use unique. The unique function returns the unique
rows and sorts them by their row times.
uniqueRowsTT = unique(sortedTT)
uniqueRowsTT=9×3 timetable
Time
Temp
Rain
WindSpeed
____________________
____
____
_________
09-Jun-2016 05:03:11
66.2
0.05
3
09-Jun-2016 06:01:04
73
0.01
2.3
09-Jun-2016 07:59:23
59
0.08
0.9
09-Jun-2016 08:49:10
62
0.01
2.7
09-Jun-2016 08:49:10
67.2
0.01
2.7
09-Jun-2016 08:49:10
75.8
0.01
2.7
09-Jun-2016 08:49:10
82
0.01
2.7
09-Jun-2016 09:53:57
59
0.03
3.4
09-Jun-2016 09:53:57
67
0.03
3.4
Find Rows with Duplicate Times and Different Data
Timetables can have rows with duplicate row times but different data values. In this example,
uniqueRowsTT has several rows with the same row times but different values.
Find the rows that have duplicate row times. First, sort the row times and find consecutive times that
have no difference between them. Times with no difference between them are the duplicates. Index
back into the vector of row times and return a unique set of times that identify the duplicate row
times in uniqueRowsTT.
dupTimes = sort(uniqueRowsTT.Time);
tf = (diff(dupTimes) == 0);
dupTimes = dupTimes(tf);
dupTimes = unique(dupTimes)
dupTimes = 2x1 datetime
09-Jun-2016 08:49:10
09-Jun-2016 09:53:57
Clean Timetable with Missing, Duplicate, or Nonuniform Times
10-31
