How to populate complete time series with incomplete data
조회 수: 1 (최근 30일)
이전 댓글 표시
I have time series data with skipped periods that I wish to place onto a complete time stamp array. Rather than mm/dd format I have 'year' 'day of year (DOY)' and 'HHMM' 'Var1' like so
data=
2015 59 30 -31.42
2015 59 100 -31.21
2015 59 130 -31.06
2015 59 700 -30.9
2015 59 730 -30.38
2015 59 800 -30.07
2015 59 830 -29.83
2015 59 900 -29.69
2015 59 930 -29.53
2015 59 1000 -29.27
2015 59 1500 -26.11
2015 59 1530 -26.09
By comparing 'data' with a complete time series array 'full', I can get an 'index' value for missing periods, but I can't figure out how to bring the data (Var 1 etc) with it.
index = ismember( full(:, 3), data(:,3));
Only how to overlay the full set with NaN values for missing indices
fullindex = [index index index];
full(~fullindex)=nan;
Similar to this post http://www.mathworks.com/matlabcentral/answers/175089#answer_166928 but I can't use the 'datenum()' approach since I have DOY and different time stamps.
댓글 수: 0
채택된 답변
Chad Greene
2016년 1월 21일
You can get a vector in datenum format by
t = datenum(YEAR,1,DOY);
and if you'd like you can get t into year, month, day by
[year,month,day] = datevec(t);
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Dates and Time에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!