Incomplete time series: Fill missing dates with NaNs

조회 수: 3 (최근 30일)
pavlos
pavlos 2016년 1월 3일
댓글: pavlos 2016년 1월 3일
Hello,
I need to fill the missing dates with NaNs.
The format of the data is as follows:
month-day-year-hour-minute-second
09-01-2013-22-19-16
09-01-2013-22-34-17
09-01-2013-22-49-18
% missing data
09-02-2013-07-27-48
09-02-2013-07-42-49
09-02-2013-07-57-50
The metering interval is every 15 minutes so the number of missing data should equal to the number of 15 minute entries that are between
09-01-2013-22-49-18 and 09-02-2013-07-27-48.
Thank you.
Best,
Pavlos

답변 (1개)

Andrei Bobrov
Andrei Bobrov 2016년 1월 3일
k = datenum(['09-01-2013-22-49-18';'09-02-2013-07-27-48'],'mm-dd-yyyy-HH-MM-SS');
add = datestr(k(1):1/24/4:k(2),'mm-dd-yyyy-HH-MM-SS');
  댓글 수: 1
pavlos
pavlos 2016년 1월 3일
The code works perfectly.
Thank you.
But all the seconds are the same, i.e. SS always equals 18.
Also, is it possible to convert "add" to matrix, i.e.: with the following format of columns:
09 01 2013 22 49 18
09 01 2013 23 04 18

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 NaNs에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by