Link data through timestamps
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
Jan
2015-12-18
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.
回答(1 个)
Jan
2015-12-18
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!