I have data on phone taps with the corresponding timestamps, of one respondent for 3 weeks (21 days). It's in one row with only time stamps, so every value is a tap at a certain time. I would like to see the average amount of phone taps for every 24 hours, so i want 21 averages for this one respondent. Can anyone help me with this?
Thank you for sharing detailed explanation. I think you can do your task more simply and more efficiently by using datetime vector and retime function. The following is an example:
% Sample time stamp data timeStamp = datetime(2018,7,1)+21*days(rand(100,1)); timeStamp = sort(timeStamp);
% Daily count TT = timetable(timeStamp,ones(numel(timeStamp),1)); TT = retime(TT,'daily','sum');
The result looks like:
>> TT TT = 21×1 timetable timeStamp Var1 ___________________ ____ 2018/07/01 00:00:00 3 2018/07/02 00:00:00 7 2018/07/03 00:00:00 6 ...
And to obtain an average value (NOT a median value):
>> mean(TT.Var1) ans = 4.7619