MATLAB: How to create “Date” containers in Matlab, ignoring months and years

binarydateif statementloopMATLAB and Simulink Student Suitetabletime series

My goal is to extract specific rows from a table (see below) that fall into specific "date" containers, e.g. month-end ( 25th-31st, regardless of the month and year). Date range from Jan-2005 until Aug-2016 and time-step is "weekly".
So far I only managed to create binaries for rows that fall into a specific date period:
% T.Date=[datetime(T.Date, 'InputFormat', 'eee dd-MMM-yyyy')];
% Define date containers
tlower = datetime(2016,07,25);
tupper = datetime(2016,07,31);
% Return ones if date falls in between tlower and tupper
Binary = isbetween(T.Date,tlower,tupper)
% If "Binary" returns 1, use this row and stack it into a new table
% with same headers as table "T". -> How?
How can I create date containers that ignore months and years, returning all rows in a new table that are "month-end" ( 25th-31st of each month) ?

Best Answer

Learn to manipulate datetime objects:
Either use the day member function:
filteredtable = T(day(T.Date) > 25, :)
or directly the Day property of datetime:
filteredtable = T(T.Date.Day > 25, :)