I am working with time series data in MATLAB. I have got two vectors of date numbers, one of which relies on a somewhat subjective data source. If both vectors were perfectly accurate, all date numbers should correspond to trading days while one vector would be a 'proper subset' of the other. Unfortunately this is not the case because one of the vectors contains several date numbers which correspond to non-business days. I would like to find a way to replace all non-business days in this vector with the next available business day.
Example:
datenumbers = [736062;736063;736064;736065;736066;736067]
% corresponds to [wed, thu, fri, sat, sun, mon]
This contains [736065;736066]
which corresponds to the upcoming weekend. Because these are not working days I would like to identify the date number corresponding to the subsequent monday and change both entries so that:
datenumbers = [736062;736063;736064;736067;736067;736067]
% corresponds to [wed, thu, fri, mon, mon, mon]