MATLAB: Would be possible to calculate half hour average by using retime

averagehalf hourretime

Hello,
The current time steps allowed in retime https://www.mathworks.com/help/matlab/ref/retime.html are:
'yearly' One year
'quarterly' One quarter
'monthly' One month
'weekly' One week
'daily' One day
'hourly' One hour
'minutely' One minute
'secondly' One second
But would be possible to calculate half hour average? or other specific time step average (like 5, 10, 15 minutes…) beside the standard here mentioned?
Thanks.

Best Answer

Yes, there is an example a little bit down the in the documentation for RETIME , under this heading:
Interpolate Timetable Data to Arbitrary Times
I've copied the relevant sample code here:
%%Make sample data
Time = datetime({'2015-12-18 07:29:53';'2015-12-18 08:00:00';...
'2015-12-18 08:31:02';'2015-12-18 09:30:00'});
Temp = [37.3;41.9;45.7;39.8];
Pressure = [30.1;29.9;30.03;29.8];
TT1 = timetable(Time,Temp,Pressure)
%%Retime to 30 minute intervals
newTimes = [datetime('2015-12-18 07:30:00'):minutes(30):datetime('2015-12-18 09:30:00')];
TT2 = retime(TT1,newTimes,'linear')