필터 지우기
필터 지우기

Replace missing time steps in dataset

조회 수: 3 (최근 30일)
Olav Kleppa
Olav Kleppa 2020년 5월 7일
편집: Toder 2020년 5월 7일
I have a dataset with hourly measured data from 2013 to 2019. Some values are missing but not appearing in my dataset, and I want to include these values as NaN.
I have created a "true" time series:
%%
t1 = datenum(2013,10,1,0,0,0);
t2 = datenum(2019,10,1,0,0,0);
t = t1:(1/1440):t2;
And I also have the date number matrix,x, of my measurements, containing fewer elements. How can I fill in measured data in my new time series, and NaN where I dont have measurements?
I now have
t=52585x1 double
x=44719x1 double
Best regards,

답변 (1개)

Toder
Toder 2020년 5월 7일
편집: Toder 2020년 5월 7일
If data is the vector of your measurements at times x, you can try
Y = NaN(size(t));
Y(ismember(t,x)) = data;

카테고리

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