The timerange function is also helpful for selecting specific dates. Selecting times by comparing
datetime values can give misleading results because all datetime values include both date and
time components. However, when you specify only the date component of a datetime value, the time
component is set to midnight. Therefore, although there is data from June 26, a comparison like this
one returns no results.
any(summer08.OutageTime == datetime("2008-06-26"))
ans = logical
0
Instead, you can use timerange.
TR = timerange("2008-06-26","days");
june26 = summer08(TR,:)
june26=1×5 timetable
OutageTime
Region
Loss
Customers
RestorationTime
Cause
________________
_____________
______
_________
________________
_____________
2008-06-26 22:36
{'NorthEast'}
425.21
93612
2008-06-27 06:53
{'thunder sto
Another way to define a range is to specify a tolerance around a time using withtol. For example,
find rows from the summer of 2008 where OutageTime is within three days of Labor Day, September
1.
Select Times in Timetable
10-21
Précédent

- 467/1450

Suivant