필터 지우기
필터 지우기

Use Retime of a timetable to interpolate to timestamps of another timetable, without interpolating across NaNs

조회 수: 5 (최근 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

답변 (1개)

Walter Roberson
Walter Roberson 2024년 5월 9일
Specify a function handle for the retime aggregation method.
"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."
  댓글 수: 1
David Dean
David Dean 2024년 5월 9일
Im not sure I know how to create a function handle for this example...I posted snippets of my timetables here to better illustrate what is happening.
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
I don't know how to write a function handle that does not interpolate across that gap...

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

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by