I need some help with this function. Seems to be working except a column of data I'm working with. Tried using 'mean' and @nanmean and both result in a column filled with only NaNs. There is numeric data present, I can see it in the y variable, and it appears to show up in ycon as a 0 until line 258 where:
ycon(count==1,:) = y(ec==1,:)
ycon becomes nothing but NaNs
31 Oct 2013
Interpolates (& extrapolates) NaN elements in a 2d array.
@arnold - You've described an iterative mode filter.
While you may think it feels similar to inpaint_nans, but as John has said, it's actually a completely different type of problem in the one way that matters - how to solve it (iteratively rather than linear algebra).
I suggest you give it a shot yourself - just work out how to:
1. Find a "border" NaN pixel
2. Find the mode of its neighbours
3. Fill it in
That would be a start. You can also find hints here which point to a faster and more stable implementation involving filters:
In order to use that, you'll want to run the filter over the whole image, and then "pack" the border NaN pixels back into the original and repeat.