How can i fill intermediate dates?

조회 수: 2 (최근 30일)
Fernando Galdames Paredes
Fernando Galdames Paredes 2014년 6월 5일
댓글: Star Strider 2014년 6월 5일
Hi
I have a matrix with dates and prices.(Nx2) I know there is a function that can create a new matrix that fills all the dates missing in the matrix using the last price available.
For example:
('05-20-2014' 800 ;'05-24-2014' 850) => ('05-20-2014' 800;'05-21-2014' 800 ;'05-22-2014' 800;'05-23-2014' 800;'05-24-2014' 850)
Best Regards

채택된 답변

Star Strider
Star Strider 2014년 6월 5일
Use the interp1 function.
First, convert your date to date numbers with the datenum function. It gives days and decimal fractions-of-days, so you only need to specify integer date ranges for interpolation.
The interp1 function will interpolate all the columns in every row of your matrix you want to interpolate.
  댓글 수: 2
Fernando Galdames Paredes
Fernando Galdames Paredes 2014년 6월 5일
Thanks for the quick answer. It is just what I needed. Greetings
Star Strider
Star Strider 2014년 6월 5일
My pleasure!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Time Series Objects에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by