Fill missing data in timeseries object

12 ビュー (過去 30 日間)
Benvaulter
Benvaulter 2016 年 1 月 15 日
コメント済み: jgg 2016 年 1 月 15 日
Hi everyone,
I am working with timeseries (minute-based, so each day should have 1440 data points and corresponding time values - I use the datenum format).
Unfortunately, some days lack some data points and I would like to identify these spots by analyzing the time vector and then have Matlab fill in the missing time and a "0" as the data point. To keep processing time low, I would prefer to continue working with the datenum format and use the "addsample"-function.
Maybe someone has an idea on how to tackle this problem?
Many thanks in advance!
  1 件のコメント
jgg
jgg 2016 年 1 月 15 日
It would help if you explained your data a little more; how is it set up?
For example, if you actual time is like at = [1,2,4,5] for a 5 minute interval, you could do something like this:
observed_times = [1,2,4,5];
observed_data = [14.1,12.2,3.4,1.1];
t = [1:5];
[~,ind] = ismember(t,observed_times);
impute_data = [NaN,observed_data];
ind = ind + 1;
corr_data = impute_data(ind);
Your new time series would be t,|corr_data|. I used NaN here instead of a zero because you might actually have zeroes here, but you can easily change this.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeTime Series についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by