limit fillmissing() to only perform fill if the data gap is a single point
9 次查看(过去 30 天)
显示 更早的评论
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/295778/image.png)
0 个评论
回答(1 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Glaciology 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!