MATLAB: Removing weekends and holidays from a TimeTable

MATLABtimerangetimetable

How can one remove weekends and holidays entries from a TimeTable?
Thanks!

Best Answer

Weekends is simple:
TT = TT(~isweekend(TT.Time),:) % assumes the default name, Time, for the row times
Holidays are another story, but if you have a list of the ones you care about, use ismember on TT.Time. You may need to use dateshift to "round" to whole days, depending on what your data look like. Perhaps something like
ismember(dateshift(TT.Time,'start','day'),listOfHolidays)
Also, if you have access to the Financial Toolbox, you can use that to generate a list of dates to remove.