How do I add specific columns by interpolation in a time series matrix data?
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello, humble greetings. Please I have a time series data of monthly deformations from January 2005 to December 2015, an 82 by 119 matrix (attached above in .mat format named VC), which in actual fact should have been a matrix of 82 by 132. However, the entire data for some months (columns) are missen, which include, 2011/1, 2011/6, 2012/5, 2012/10, 2013/3, 2013/8, 2013/9, 2014/2, 2014/7, 2014/12, 2015/5, 2015/6, 2015/10, and 2015/11 as seen in the attached time (in .mat format named T2,) for the 82 by 119 matrix. My challange now is how to add data for each of these missen months by interpolation at their respective columns. each column reprsents data for a month (example, first column is for january 2005, second column is for february 2005 in that order to December 2015). I would appreciate your guide and help.
Thank you.
댓글 수: 4
Bob Thompson
2019년 2월 19일
The slow way is to run a double loop, one for each row, and one for each column. You might be able to get rid of one of those by having an array as an input for the desired values, but I don't know if you can get rid of both and put it all in one command.
for i = 1:size(data,1)
tmp = interp1(data(1,:),data(i,:),missingtimes);
data2(i,:) = [data(i,:),tmp];
end
Things are a bit out of order, but you can probably sort them easily enough.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!