Link data through timestamps
1 view (last 30 days)
Show older comments
Hi!
I loaded monitoringsdata in matlab as arrays.
As an example;
A B
[1-1-2015 0:00 20.0] [1-1-2015 0:01 154]
[1-1-2015 0:10 22.0] [1-1-2015 0:25 258]
[1-1-2015 0:20 10.0] [1-1-2015 0:33 598]
[1-1-2015 0:30 20.3] [1-1-2015 0:45 458]
[1-1-2015 0:40 14.7] [1-1-2015 0:58 987]
[1-1-2015 0:50 18.6]
[1-1-2015 1:00 13.9]
I want to plot(A,B) (or the other way around).
I want MATLAB to search for corresponding timestamps and link the data.
Most of the data is collected with an interval of 10min, but some data is random collected in time or with an interval of 1 min.
So not all arrays have the same lenght.
For example, I want 1-1-2015 0:40 to correspond with a datapoint (or the avarage of points) between 1-1-2015 0:35 and 1-1-2015 0:44.
Is it possible to do this with MATLAB? If yes, how?
I couldn't find much usefull material on the internet.
Thank you!
1 Comment
Jan
on 18 Dec 2015
The type and size of A and B and their elements is not clear. Perhaps you mean a string like: '1-1-2015 0:00 20.0', or a cell string like {'1-1-2015 0:00', '20.0'} or a mixed cell like {'1-1-2015 0:00', 20.0} or whatever. Please post the data in a format, which recreates it, when the readers insert it in the command window by copy&paste.
Answers (1)
Jan
on 18 Dec 2015
Convert the dates and times to Matlab's datenum format. Then find the corresponding bins using histcounts.
Explicite code can be posted, if you specify the data format uniquely.
1 Comment
See Also
Categories
Find more on Dates and Time 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!