Filter löschen
Filter löschen

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

10 Ansichten (letzte 30 Tage)
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.

Antworten (1)

Shubh Sohal
Shubh Sohal am 6 Okt. 2020
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.

Kategorien

Mehr zu Glaciology finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by