MATLAB: Filter only specific month from date serial number filter date Hi guys, I got a column with a date serial number and I would like to filter only the month of march. What is the coding for that? Best Answer Unless you're using a version prior to R2014b, use datetimes:>> dn = 736696 + 90*rand(10,1)dn = 736755.016662924 736699.214051072 736772.421637528 736780.059392298 736757.086163937 736764.196611752 736762.881922131 736731.300431758 736754.993010116 736711.406801903>> d = datetime(dn,'ConvertFrom','datenum')d = 10×1 datetime array 01-Mar-2017 00:23:59 04-Jan-2017 05:08:14 18-Mar-2017 10:07:09 26-Mar-2017 01:25:31 03-Mar-2017 02:04:04 10-Mar-2017 04:43:07 08-Mar-2017 21:09:58 05-Feb-2017 07:12:37 28-Feb-2017 23:49:56 16-Jan-2017 09:45:47>> (d.Month == 3)ans = 10×1 logical array 1 0 1 1 1 1 1 0 0 0Prior to 14b, use datevec. Related SolutionsMATLAB: How to arrenge timeseries data use sort? [~,indx] = sort(data(:,1)); sortedData = data(indx,:); MATLAB: Creating index from datetime vector days Take the month number output as well as the day output. If the day is less than 15, subtract 1 from the month number to get the index (if the month number was 1, substitute 12 for previous year); otherwise use the month number directly. Related QuestionHow to merge a datetime array with a tableSelect row from matrix based on month with datenumTime series data with missing dates to remap to calendar days vector
Best Answer