Hi, I'm updating some code to use the new datetime format in 2014b for plotting and display purposes, but I'm struggling to interpolate my data. Previously I was using the line below where Data.Time and NewData.Time were datenum, but now I've converted them to the datetime format, I can no longer interpolate it. Is there an easy way around this?
NewData.Latitude = interp1(Data.Time,Data.Latitude,NewData.Time);
Thanks, Tom

 채택된 답변

the cyclist
the cyclist 2014년 10월 8일

0 개 추천

I could not figure out a way to do this without (ironically) needing to convert the datetime object back to a datenum [in order to have a numeric value for interp1() to operate on].
I thought that maybe defining the time and data as a timeseries object and then using the resample command would work, but it seems that that method also requires something more datenum-y.

댓글 수: 1

Tom
Tom 2014년 10월 8일
Same, for anyone else, I got it working with the following code;
NewData.Latitude = interp1(datenum(Data.Time),Data.Latitude,datenum(NewData.Time));

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Dates and Time에 대해 자세히 알아보기

제품

질문:

Tom
2014년 10월 8일

댓글:

Tom
2014년 10월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by