MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1

09-Jun-2016 08:49:10 67.2 0.01 2.7


Sort Timetable and Determine Whether It Is Regular


Determine whether TT is sorted. Then, sort the timetable on its row times using the
sortrows function.


TF = issorted(TT)


TF = logical
0


TT = sortrows(TT)


TT=10×4 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 75.8 0.01 2.7
09-Jun-2016 08:49:10 82 0.01 2.7
09-Jun-2016 08:49:10 67.2 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
09-Jun-2016 09:53:57 67 0.03 3.4


Determine whether TT is regular. A regular timetable has the same time interval between
consecutive row times. Even a sorted timetable can have time steps that are not uniform.


TF = isregular(TT)


TF = logical
0


Display the differences between row times.


diff(TT.Time)


ans = 9x1 duration array
00:57:53


Clean Timetable with Missing, Duplicate, or Nonuniform Times
Free download pdf