MATLAB: Removing Leap day from the timetable

detectleap dayleapdayMATLABremoveremove leap days

I need to remove leap days of all years from my timetable. I mean all values belong to 29 feb. my timetable is a hourly time table.

Best Answer

  • TT is the timetable and TT.Time is the time column.
    isLeapDay is a logical vector identiying the rows of TT that belong to a leap day.
    isLeapDay = month(TT.Time)==2 & day(TT.Time)==29;
    TT(isLeapDay,:) = []; % remove leap days.