Split timetable using retime

1 回表示 (過去 30 日間)
Jonas Cervelim
Jonas Cervelim 2019 年 5 月 30 日
回答済み: Peter Perkins 2019 年 6 月 4 日
Hi!
I have many .csv files with different datetime informations. I need to split them into 4 diary periods, which means that I should take a mean of data acquired in same daytime but in different days.
I am trying to use retime function to execute this job, but it's not working to aggregate different days in the timetable.
Here is the code I am using:
newTimes1 = [datetime('28/05/2019 00:00:00'):minutes(5):datetime('28/05/2019 05:59:59')];
newTimes2 = [datetime('28/05/2019 06:00:00'):minutes(5):datetime('28/05/2019 11:59:59')];
newTimes3 = [datetime('28/05/2019 12:00:00'):minutes(5):datetime('28/05/2019 17:59:59')];
newTimes4 = [datetime('28/05/2019 18:00:00'):minutes(5):datetime('28/05/2019 23:59:59')];
T1 = retime(TT,newTimes1,'mean')
T2 = retime(TT,newTimes2,'mean')
T3 = retime(TT,newTimes3,'mean')
T4 = retime(TT,newTimes4,'mean')
Is there a way to concatenate this data only by time, not date?
Is there a way to write datetime only for time, not day?
OR
Am I using the best alternative to execute this chore?

回答 (1 件)

Peter Perkins
Peter Perkins 2019 年 6 月 4 日
You are using datetimes, which is a linear time line. It sounds like you want "time of day", which is a circular time line. I can't really tell exactly what you need, but a first guess is to use the timeofday function on the time vectors of all your timetables.
Except that in your example, you onl;y show one day. It's possible that you just want to change the display format of the datetimes to not show the date? A simple clear concrete example would help.

カテゴリ

Help Center および File ExchangeTables についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by