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!