Split timetable using retime

4 views (last 30 days)
Jonas Cervelim
Jonas Cervelim on 30 May 2019
Answered: Peter Perkins on 4 Jun 2019
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?

Answers (1)

Peter Perkins
Peter Perkins on 4 Jun 2019
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.

Categories

Find more on Tables in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!