필터 지우기
필터 지우기

limit fillmissing() to only perform fill if the data gap is a single point

조회 수: 10 (최근 30일)
Justin Bell
Justin Bell 2020년 5월 20일
답변: Shubh Sohal 2020년 10월 6일
I am climate reading data into a timetable, some of the data has gaps of varying size. I am trying to control how data is backfilled when it is missing. Right now I am ussing something like this
dataTable.AirTemp = fillmissing(dataTable.AirTemp, 'linear');
Which seems to work fine for what I need. (see picture attached). However I am trying to find a simple way to make it only fill gaps that are a one or two NaN long. If there are multiple NaN in a row, I don't want to fill the gap. I don't see any input options that wold control that. Is there a better method or an elegant solution for this? I've got to imagine this is common.

답변 (1개)

Shubh Sohal
Shubh Sohal 2020년 10월 6일
Hi Justin, I believe using 'MaxGap' parameter with the fillmissing function would be helpful to achieve what you want in your case.
This will allow you to fill the missing values only depending on the MaxGap that you will define using the sample point unit input. So, in case you want to only fill a single NaN occurrence or two consecutive NaN occurrences, you can specify the 'MaxGap' value accordingly.

카테고리

Help CenterFile Exchange에서 Glaciology에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by