フィルターのクリア

How to merge two interleaving time series?

35 ビュー (過去 30 日間)
Larissa Perez
Larissa Perez 2019 年 2 月 14 日
コメント済み: Larissa Perez 2019 年 3 月 12 日
I have two different data sets that were measured in interleaving in time. Ex.
Data 1: measures 2400 points and stops Data 1: 2400 again and so on..
Data 2: measures 1200 points and stops
I need to merge these signals based on their timestamp. Initially I tried concatenating the two time vectors and sorting in an ascending order and then join the signals using an if, but that didn't work.
What is the quickest way to do so? Is there any specific function that does that to me? The time vectors are in datenum format.
Many thanks!

採用された回答

Peter Perkins
Peter Perkins 2019 年 3 月 11 日
Larissa, I strongly suggest that you convert those datenums to datetimes (or durations? not sure, not enough information from you) and use timetables. At that point, it's just a matter of concatenating and sorting.
That's assuming the two data sets are measuring the same thing. If they are measuring different things, then you would not want to concatenate -- you'd use synchronize instead.
  1 件のコメント
Larissa Perez
Larissa Perez 2019 年 3 月 12 日
Thanks Peter! I ended up being able to do it by creating a new time vector that included all the data points and then using the function intersect.

サインインしてコメントする。

その他の回答 (1 件)

Agnish Dutta
Agnish Dutta 2019 年 2 月 26 日
編集済み: Agnish Dutta 2019 年 2 月 26 日
I'm assuming, you don't have any gaps in your time series data.
One way of doing this would be to put you time series data into 2 different .MAT files. Then, merge the data into a single .MAT file.
You'll obtain a .MAT file that'll look like this:
fin_MAT
Time Value1 Value2 ... Value16000
datetime1 val11 val21 ... val160001
datetime2 val22 val22 ... val160002
. . . ... .
. . . ... .
. . . ... .
datetimeX val1X val2X ... val16000X
Then, proceed to create a new time series variable from the data in the .MAT file.
fin_ts = timeseries(fin_MAT(:, 2:end), <your_time_vector>, 'name', 'xyz');
Refer to the following for more information:

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

タグ

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by