timetable

Methods

Method Reference: timetable.isregular

timetable: TF = isregular (tt)
timetable: TF = isregular (tt, unit)

True when the row times of a timetable are evenly spaced.

TF = isregular (tt) returns true when tt is regular with respect to absolute time, that is when consecutive row times are separated by the same fixed length of time. A calendar month has no fixed length, so a monthly timetable answers false here and true for 'months' below.

TF = isregular (tt, unit) returns true when the row times are evenly spaced by a whole number of unit, one of 'time', 'days', 'weeks', 'months', 'quarters' or 'years'. 'time' means absolute time and is what the one-argument form asks. There is no unit smaller than a day: an hourly timetable is regular in time and in nothing else.

The calendar units are measured on the calendar rather than in elapsed time, which is what separates them. Across a daylight saving change a run of calendar days is regular in 'days' and regular in nothing else, one of those days being an hour shorter than the rest, and such a timetable reports no time step at all while still answering true here.

A timetable with fewer than two rows has no spacing to measure and answers from the time step it remembers, so a single row taken out of a timetable told it was hourly is still regular in time, while one taken out of a timetable that read its step off its row times is not.

The answer is always computed from the row times and unit is always checked, which MATLAB does neither of when the step was declared with 'TimeStep' or 'SampleRate' and is a duration: there it answers from the stored step alone. Two consequences follow there and not here. A misspelt unit, and the non-units 'seconds', 'minutes' and 'hours', come back false rather than raising. And two timetables with identical row times disagree: times built as d0 + hours (0:24:96) answer true for 'days' while the same times declared as 'TimeStep', hours (24) answer false. Both answer true here.

See also: timetable

Source Code: timetable