MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1

ans=5×6 timetable
OutageTime Region Loss Customers RestorationTime Cause




2002-02-01 12:18 SouthWest 458.98 1.8202e+06 2002-02-07 16:50 winter storm
2003-01-23 00:49 SouthEast 530.14 2.1204e+05 NaT winter storm
2003-02-07 21:15 SouthEast 289.4 1.4294e+05 2003-02-17 08:14 winter storm
2002-03-16 06:18 MidWest 186.44 2.1275e+05 2002-03-18 23:23 severe storm
2003-06-18 02:49 West 0 0 2003-06-18 10:54 attack


Display the last five rows of TT2.


TT2(end-4:end,:)


ans=5×6 timetable
OutageTime Region Loss Customers RestorationTime Cause




2003-09-02 19:46 SouthEast 0 0 2003-09-16 22:25 severe storm
2003-09-15 14:56 MidWest 418.7 61045 2003-09-22 04:21 thunder storm
2003-09-24 22:43 SouthWest 2576.9 9.4873e+05 2003-09-25 14:46 severe storm
2003-09-18 10:40 SouthWest 301.8 2.3973e+05 2003-09-27 08:17 severe storm
2003-10-11 19:36 SouthEast 309.8 93582 2003-10-11 19:49 energy emergency


TT2 is a timetable with only 98 rows, containing outage data only from 2002 and 2003.


Index on Specified Times


You can index into TT with datetime values or character vectors representing specific
times in TT.OutageTime. But when you do so, the times you specify must have exact
matches in the time vector, and only those times are selected. Index into TT on times for
the first and third rows of TT.


TT({'2002-02-01 12:18:00','2003-02-07 21:15:00'},:)


ans=2×6 timetable
OutageTime Region Loss Customers RestorationTime Cause




2002-02-01 12:18 SouthWest 458.98 1.8202e+06 2002-02-07 16:50 winter storm
2003-02-07 21:15 SouthEast 289.4 1.4294e+05 2003-02-17 08:14 winter storm


Select Timetable Data by Row Time and Variable Type
Free download pdf