필터 지우기
필터 지우기

Fill missing data in timeseries object

조회 수: 9 (최근 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 CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by