Looking for information on sinking mismatched time series

1 view (last 30 days)
Hi, I'm struggleing to phase a question so I can search the help file. I have two instruments producing 1 second data and I want to compare the out put directly, but as with all instrumentation, ocationaly, one instrument will drop a second so the two outputs are slightly mismatched in places. I am looking for a command whcih will allow me to create one time stamp with 2 columns of data with blanks where no data is available.
Example
data I have
data stream 1,,data stream 2,
17:31:01,333,17:31:01,332
17:31:02,345,17:31:02,344
17:31:04,321,17:31:03,326
17:31:05,365,17:31:05,363
17:31:06,352,17:31:06,358
17:31:07,389,17:31:08,381
data I want
Time,instrument1,instrument 2,
17:31:01,333,332,
17:31:02,345,344,
17:31:03,,326,
17:31:04,321,,
17:31:05,365,363,
17:31:06,352,358,
17:31:07,389,,
17:31:08,,381,
I'm not realy sure what to call this type of operation or if in fact matlab already has a command for this. I just feel like there should be one! Any help greatfully received.
Karen

Accepted Answer

Walter Roberson
Walter Roberson on 13 Apr 2012
unique() the two sets of timestamps together in the same array, to get the joint list of timestamps.
ismember() the first set of timestamps against the joint list. The locations not matched will require NaN for the first series.
ismember() the second set of timestamps against the joint list. The locations not matched will require NaN for the second series.

More Answers (1)

Sean de Wolski
Sean de Wolski on 13 Apr 2012
Fill those points with Nan.
doc nan
  1 Comment
Karen Hornsby
Karen Hornsby on 13 Apr 2012
I realize I will need to add nans to the output, but I want to know how to generate the single time stamp and then sample the data into a single matrix.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!