Info

This question is closed. Reopen it to edit or answer.

grouping measures by time

1 view (last 30 days)
Valerio
Valerio on 30 Jan 2014
Closed: MATLAB Answer Bot on 20 Aug 2021
I have a problem to extract data from a cell array.
The array has 4 columns:
1 - date (ex. '27-May-2013') 2 - time (ex. '09:47:39') 3 - category (1-36) 4 - measures
I need to separate the 36 categories and sum the measures every 10 minutes.
The frequency acquisition is not constant (approximately one measure/10 seconds). I tried to make the sum of the measures every 10 minutes (00:10:00), but I am not able to obtain a constant grouping at perfectly 00:10:00.
It is not a problem if I will have different numbers of measures in each 10 minutes interval, but the interval need to be exactly 00:10:00.
Do you have any suggestions?
Thank you

Answers (1)

Amit
Amit on 30 Jan 2014
Your cell column 1 and 2 represent date and time. you can use datenum to determine time difference. for example (assuming you cell array is named A):
formatIn = 'dd-mmm-yyyy HH:MM:SS'; % I am assuming the months are 3 letters only
time_in = datenum([A{1,1} ' ' A{1,2}],formatIn); % This will give you a numerical value
time_2 = datenum([A{i,1} ' ' A{i,2}],formatIn); % This will give you a numerical value
You have to loop through until
(time_2 - time_in)*24*60 <= 10

Community Treasure Hunt

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

Start Hunting!