Time Sync Data from two files
6 views (last 30 days)
Show older comments
Hi,
I have two excel sheets of data from two devices. The first dataset [DATA 1] is a ~2000x5 matrix that had a sampling rate of 1 sample/sec. The second dataset [DATA 2] is a ~300x3 matrix that had a sampling rate of 1 sample/3 sec (actually, the sampling rate is inconsistent and switches between 1 sample/3 sec and 1 sample/4 sec).
I'd like to sync the data such that I retain all of the data points from DATA 1, and DATA 2 is appropriately matched up according to its time. Ideally, there would be empty cells for the 2 or 3 seconds where there is no data from DATA 2.
I thought I'd try to synchronize with timeseries, but that only outputs 'union' timepoint I think. I'd like to keep all of DATA 1 instead of removing the points where there is no intersection. Then, I thought about an ugly nested for loop where I might compare the timepoints in DATA 2 and DATA 1 and insert an empty row of cells into DATA 2 matrix where TIME 1 does not equal TIME 2, but I think that would be a very bad method and was wondering if there is any better method.
Thank you in advance.
0 Comments
Answers (1)
the cyclist
on 2 Oct 2014
Do the timestamps in the two files match exactly, or only approximately? If the former, I bet you could use the ismember() function.
2 Comments
the cyclist
on 3 Oct 2014
Tough to diagnose without more info. Would it be possible for you to post a small but representative subset of your data to illustrate what you are trying to do? The ideal is self-contained MATLAB code, with inputs included (so that we can actually run what you have), along with what you hope the output to look like.
See Also
Categories
Find more on Tables 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!