Reducing nonuniform-timed data to x-minute averages
Show older comments
I have an incredible amount of data recorded at nonuniform time intervals. I'll like to boil the data down to a multi-minute averages, which can be defined by a variable within the code, say "windowAvg" or "interval". I also have large gaps within the data where no data was recorded, and I'd need to represent that data as well with zeroes or "NaN" or something similar. Here's an example of what the data may look like:
- DATE TIME (HH:MM:SS) DATA
- 1-Mar-12 21:40:58 7.714284452
- 1-Mar-12 21:40:59 7.076270192
- 1-Mar-12 21:41:00 6.852246256
- 1-Mar-12 21:41:01 8.065426585
- 1-Mar-12 21:41:11 6.17580769
- 1-Mar-12 21:41:12 8.216123385
- 1-Mar-12 21:41:14 7.811008001
- 1-Mar-12 21:41:15 6.888230101....etc
And then what I need it to look like (for example, 5-min avg):
- DATE TIME (HH:MM:SS) DATA
- 1-Mar-12 21:40:00 7.825590127
- 1-Mar-12 21:45:00 7.488390079
- 1-Mar-12 21:50:00 NaN
- 1-Mar-12 21:55:00 7.314028628
My general plan was to create a full day's worth of a timestamp variable (I already have it in MATLAB serial time form), and then "find" where the data fall into the different time intervals, average, and then map the averaged value to the appropriate interval. I have a feeling, though, that there's an easier way to do this with obscure functions that I don't know about. I would appreciate any help.
Thanks, Nic
Accepted Answer
More Answers (0)
Categories
Find more on Calendar 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!