Looking for information on sinking mismatched time series

2 vues (au cours des 30 derniers jours)
Karen Hornsby
Karen Hornsby le 13 Avr 2012
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

Réponse acceptée

Walter Roberson
Walter Roberson le 13 Avr 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.

Plus de réponses (1)

Sean de Wolski
Sean de Wolski le 13 Avr 2012
Fill those points with Nan.
doc nan
  1 commentaire
Karen Hornsby
Karen Hornsby le 13 Avr 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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Shifting and Sorting Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by