How to populate complete time series with incomplete data
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Colin Edgar
am 21 Jan. 2016
Beantwortet: Colin Edgar
am 21 Jan. 2016
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 Kommentare
Akzeptierte Antwort
Chad Greene
am 21 Jan. 2016
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 Kommentar
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!