Use Retime of a timetable to interpolate to timestamps of another timetable, without interpolating across NaNs
4 次查看(过去 30 天)
显示 更早的评论
I am trying to interpolate values within one timetable to the timestamps in another timetable. However, I do not want to interpolate across gaps where NaNs exist, which occurs when using the standard retime function.
For example:
I have continuous data here with time on the left, and values on the right. This timetable is named "CC"
'12/12/2010 09:30' 0.119000000000000
'12/12/2010 09:45' NaN
'12/12/2010 10:00' NaN
'12/12/2010 10:15' NaN
'12/12/2010 10:30' NaN
'12/12/2010 10:45' NaN
'12/12/2010 11:00' NaN
'12/12/2010 11:15' NaN
'12/12/2010 11:30' NaN
'12/12/2010 11:45' NaN
'12/12/2010 12:00' NaN
'12/12/2010 12:15' NaN
'12/12/2010 12:30' NaN
'12/12/2010 12:45' 0.105000000000000
I would like to linearly interpolate these values to the timestamp below. This timetable is named "CSE"
'12/12/2010 12:00' 0.127000000000000
When I use retime to interpolate CC to the time of CSE, I would like it to return NaN , but instead it interpolates across the gap.
CSEC=retime(CC,CSE.meanTime_CST_,'linear');
The output is this:
'12/12/2010 12:00' 0.108230769230769
0 个评论
回答(1 个)
Walter Roberson
2024-5-9
"All the listed methods omit NaNs, NaTs, and other missing data indicators, except for func. To include missing data indicators, specify func as a function handle to a function that includes them when aggregating data."
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!