Load Timetable
Load a sample timetable from the MAT-file badTimes that contains weather measurements taken
over several hours on June 9, 2016. The timetable TT includes temperature, rainfall, and wind speed
measurements taken at irregular times during that day.
load badTimes
TT
TT=12×3 timetable
Time
Temp
Rain
WindSpeed
____________________
____
____
_________
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 09:53:57
59
0.03
3.4
09-Jun-2016 09:53:57
67
0.03
3.4
NaT
56
0
0
09-Jun-2016 09:53:57
67
0.03
3.4
09-Jun-2016 08:49:10
62
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 05:03:11
66.2
0.05
3
09-Jun-2016 08:49:10
67.2
0.01
2.7
09-Jun-2016 04:12:00
58.8
NaN
NaN
Find and Remove Rows with Missing Row Times
One way to begin is by finding and removing rows that have a NaT, or missing value, as the row time.
To find missing values in the vector of row times, use ismissing. The ismissing function returns a
logical vector that contains 1 wherever TT.Time has a missing value.
natRowTimes = ismissing(TT.Time)
natRowTimes = 12x1 logical array
0
0
0
0
1
0
0
0
0
0
⋮
To keep only those rows that do not have missing values as row times, index into TT using
~natRowTimes as row indices. Assign those rows to a new timetable, goodRowTimesTT.
goodRowTimesTT = TT(~natRowTimes,:)
goodRowTimesTT=11×3 timetable
Time
Temp
Rain
WindSpeed
____________________
____
____
_________
10 Timetables
10-28
Load a sample timetable from the MAT-file badTimes that contains weather measurements taken
over several hours on June 9, 2016. The timetable TT includes temperature, rainfall, and wind speed
measurements taken at irregular times during that day.
load badTimes
TT
TT=12×3 timetable
Time
Temp
Rain
WindSpeed
____________________
____
____
_________
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 09:53:57
59
0.03
3.4
09-Jun-2016 09:53:57
67
0.03
3.4
NaT
56
0
0
09-Jun-2016 09:53:57
67
0.03
3.4
09-Jun-2016 08:49:10
62
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 05:03:11
66.2
0.05
3
09-Jun-2016 08:49:10
67.2
0.01
2.7
09-Jun-2016 04:12:00
58.8
NaN
NaN
Find and Remove Rows with Missing Row Times
One way to begin is by finding and removing rows that have a NaT, or missing value, as the row time.
To find missing values in the vector of row times, use ismissing. The ismissing function returns a
logical vector that contains 1 wherever TT.Time has a missing value.
natRowTimes = ismissing(TT.Time)
natRowTimes = 12x1 logical array
0
0
0
0
1
0
0
0
0
0
⋮
To keep only those rows that do not have missing values as row times, index into TT using
~natRowTimes as row indices. Assign those rows to a new timetable, goodRowTimesTT.
goodRowTimesTT = TT(~natRowTimes,:)
goodRowTimesTT=11×3 timetable
Time
Temp
Rain
WindSpeed
____________________
____
____
_________
10 Timetables
10-28
