MATLAB Answers

How can I divide a week of a timetable into hours

8 views (last 30 days)
is it possible to devide a week of a timetable into 168 hours?
I would need the means of a timetable from monday to sunday on an hourly basis so I can show how its behaving of the week
Thx :)


Antonio Melieni
Antonio Melieni on 15 May 2019
So what I need is the mean over each of the 168 hours of the week from these data

Sign in to comment.

Accepted Answer

Guillaume on 15 May 2019
hourlytimetable = retime(yourtimetable, 'hourly', 'mean')


Show 6 older comments
Peter Perkins
Peter Perkins on 16 May 2019
Guillaume is correct.
retime can do hourly (or whatever) summaries, but only on a linear time line. You are asking for a cyclic time line. Adding a dummy variable for "hour of week" and grouping on that is the way to go. groupsummary, or splitapply, or varfun would allwork; groupsummary is probably the simplest.
Guillaume on 16 May 2019
Peter, a suggestion: an option to specify bin indices instead of bin intervals for groupsummary at least. That would avoid having to create the binning variable:
hourofweek = ...
groupsummary(Volatility, 'BinNumbers', hourofweek, 'mean')
Peter Perkins
Peter Perkins on 20 May 2019
Yes, this would be useful in many contexts. Thanks.

Sign in to comment.

More Answers (0)

Sign in to answer this question.