I have a vector of temperatures and a cell array of Date/Time. I want to create 4 variables where each variable represents different stages of the day. For example, I need to create a variable for all of the temperatures recorded between 09:00 – 15:00, 15:00-21:00, 21:00-03:00, and 03:00-09:00 for the entire year.
So, if the temperature was recorded hourly for a year I would have 8760 measurements, I would like to break this down into separate variable corresponding to the times shown above.
clear allStartDate = '2011-01-01 00:00';EndDate = '2011-12-31 23:57';Resolution = 60;DateTime=datestr(datenum(StartDate,'yyyy-mm-dd HH:MM'):Resolution/(60*24):... datenum(EndDate,'yyyy-mm-dd HH:MM'),'yyyy-mm-dd HH:MM');DateTime=cellstr(DateTime);data = 1 + (20-1).*rand(8760,1);
So, in the end I will have a variable which has the temperatures between those times taken each day for the entire year. Will this be possible with the current format of the DateTime vector? If I convert it to decimal days then I'm afraid I'll lose track of the times which I need. Thanks for your time.
Best Answer