How to deal with multiple time series in MATLAB?

17 views (last 30 days)
I have some smart meter data which shows gas and electricity meter readings at 30 min intervals for about two years, for 16000 households. The date is stored in separate .mat files, with a datetime variable for the timestamp and a double variable for the actual data. Some of the data has gaps in, from a few hours to several days or weeks. I want to create a timeseries object containing all of the data and a continuous timestamp for the two year period, so that I can then interpolate the gaps. Another option would be to use snychronize, but for this it seems the 16000 data series need to be in individual timeseries objects, which seems cumbersome. I have tried this with timeseries objects and financial time series but cannot get all of the 16000 data series and corresponding timestamps into one time series object. When I try to add more than one series to an existing timeseries object, it is added "in series" rather than "in parallel" (i.e. data in the Data:1 column). When I tried with a financial time series I had difficulties preparing the datetime data in a cell array. Any ideas what the most efficient way to do this is? Thanks Russell

Answers (1)

Nikhil Vyas
Nikhil Vyas on 26 Apr 2016
The approach I would use is: merge the MAT files, initialize the N x 16000 timeseries.
So basically after merging, your final MAT file would have the following data:
fin_MAT
Time Value1 Value2 ... Value16000
datetime1 val11 val21 ... val160001
datetime2 val22 val22 ... val160002
. . . ... .
. . . ... .
. . . ... .
datetimeX val1X val2X ... val16000X
From this, you can create a timseries using something like the following:
fin_ts = timeseries(fin_MAT(:, 2:end), <your_time_vector>, 'name', 'xyz');
  2 Comments
Russell
Russell on 26 Apr 2016
Thanks Nikhil, but this solution assumes that all of the data series have the same common timestamp readings, but this is not the case. As I wrote, each household has (unique) gaps in the data, which last from a few hours to several weeks. This means that each household requires a separate timeseries, or needs to be "mapped" to the same time vector, taking account for the gaps in the data.
Sriram Jayachandran Raguraman
Hello Russell,
I'm having a similar problem for my project. could you tell me how to solve this problem ? How did you organise the data and passed it to the network ?

Sign in to comment.

Categories

Find more on Time Series in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!