MATLAB: Repeating a time series from yyy-MM-dd to yyyy-MM-dd-hh-mm

MATLABtime series

I have a matrix where the first column is a time series with dates down to one minute resolution, in the format: yyyy-MM-dd-hh-mm. And in the columns next to it I want to add several types of measured data.
The problem is that some of this data has a lower resolution, for example only measured once a day in the format: yyyy-MM-dd.
What I want to do is insert this data in the high resolution matrix and having the daily values repeated across all hours and minutes of the correct day so that there are no gaps between the values.
Example: I have carbon dioxide data from 2011 measured daily. I want the measured value for 2011-01-01 to be repeated in the bigger matrix all the way from 2011-01-01-00-00 to 2011-01-01-23-59 where then 2011-01-02 starts and so on..
I imagine this shouldn’t be too complicated to do but I’m having trouble figuring out how to do it. Any suggestions?
Thanks.

Best Answer

Actually, for this I would use date vectors. You can then use ismember with the 'rows' option to locate the matching rows of minute and daily data (using only the year month day columns of the date vectors):
%demo data, yours does not overlap:
DailyDatenum = [734504:734868; 1:365]';
MinuteDatenum = [734502:1/24/60:734870]';
Dailydv = datevec(DailyDatenum(:, 1));
Minutedv = datevec(MinuteDatenum(:, 1));
[ispresent, row] = ismember(Minutedv(:, 1:3), Dailydv(:, 1:3), 'rows');
MinuteDatenum(ispresent, 2) = DailyDatenum(row(ispresent), 2);