How to fill missing data in timeseries objeject Matlab

조회 수: 4 (최근 30일)
buer
buer 2014년 12월 10일
댓글: buer 2014년 12월 18일
Hello all,
I got one problem with the filling missing data.
1123423 33
1123443 33
1123460 34
1123478 35
1123490 35
So basically, between 1123423-1123459 the value are all 33. then from 1123460-1123477 the values are all 34. from 1123478--are 35
so I need to fill all the data between :
index value
1123423 33
1123424 33
1123425 33
1123426 33
...
1123442 33
1123443 33
1123460 34
1123478 35
1123490 35
I tried with fillts(), but my Matlab 2013 does not have that function. Anyone can give some idea?
I plan to read the old value to new mat file. and when the index is not in the old file, put the previous value from old mat file to the new mat file value....honestly I do not know about the speed, even the implementation itself might be not possible....
Anyone has some experience in this? please give some advice. I will be very appreciate! Thanks
  댓글 수: 1
buer
buer 2014년 12월 17일
No one knows this? Or is that I did not explain it clearly? people can say it is just copy one file to another line by line, during which filling the missing data....

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

채택된 답변

Joseph Cheng
Joseph Cheng 2014년 12월 17일
you can try this
%Generate example
examp = [1123423 33;...
1123443 33;...
1123460 34;...
1123478 35;...
1123490 35];
% create the new range
Frange = [examp(1,1):examp(end,1)]';
% find where the values you know fall on the range
loc = find(ismember(Frange,examp(:,1)));
%create new matrix to insert the data
FilledData = [Frange zeros(size(Frange))];
% insert additional point for the last point incase Frange is defined to go
% farther than the last point in example.
loc = [loc;length(Frange)+1];
%propogate the data to the next point you know.
for ind = 1:length(loc)-1
range = [loc(ind):loc(ind+1)-1]';
FilledData(range,2)=examp(ind,2);
end
  댓글 수: 1
buer
buer 2014년 12월 18일
This is soooooo great...I will check very careful..thanks a lot..it works now...

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Standard File Formats에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by