MATLAB: Extract rows from matrix based on date

datenummatrix

I have a 88416 x 11 matrix. Hourly date and time datenum values are in column 1. The hourly date range is from 2006-12-1 to 2016-12-31. If the date is 2007-10-28 I want to remove it from the matrix and create a new matrix that contains it and all the values in that row. I want to repeat this for several dates. How do I do it?

Best Answer

If you have R2016b or later, use a timetable() object, and extract rows using a timerange; https://www.mathworks.com/help/matlab/matlab_prog/subscript-into-times-of-timetable.html#zmw57dd0e28127