Creating a daily date vector
显示 更早的评论
Hello,
I hope this is a fairly easy question for the community. I have a half hourly datetime vector which I would like to convert to a daily datetime vector. I don't seem to be having any luck. There must be a simple code to do this? Any help would be much appreciated.
Here is an example of my data: date2017 (17520x1 datetime)
date2017 =
'01/01/2017 00:30:01'
'01/01/2017 01:00:01'
'01/01/2017 01:30:01'
'01/01/2017 02:00:01'
'01/01/2017 02:30:01'
'01/01/2017 03:00:01'
'01/01/2017 03:30:01'
'01/01/2017 04:00:01'
'01/01/2017 04:30:01'
'01/01/2017 05:00:01'
'01/01/2017 05:30:01'
'01/01/2017 06:00:01'
'01/01/2017 06:30:01'
'01/01/2017 07:00:01'
'01/01/2017 07:30:01'
'01/01/2017 08:00:01'
'01/01/2017 08:30:01'
'01/01/2017 09:00:01'
'01/01/2017 09:30:01'
'01/01/2017 10:00:01'
'01/01/2017 10:30:01'
'01/01/2017 11:00:01'
'01/01/2017 11:30:01'
'01/01/2017 12:00:01'
'01/01/2017 12:30:01'
'01/01/2017 13:00:01'
'01/01/2017 13:30:01'
'01/01/2017 14:00:01'
'01/01/2017 14:30:01'
I'd like to do this so that I can match it to daily mean values I have for temperature.
I tried this but something went wrong. I ended up with a DateDaily (367x0 timetable) vector, so no date values.
T = table(date2017, 'VariableNames' , {'Date'});
D = table2timetable(T);
DateDaily = retime(D, 'daily');
Thank you!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!