I have a 1-d data file with occasional NaN values. If I apply movmean
to this input data, is there a simple way to set the movmean value to NaN if the number of input values within the moving window is greater than a threshold value? For example, if the window length is 10 and a threshold value is 3, I would like the movmean value to be NaN for this set of 10 values:
[1 3 NaN 4 NaN 2 5 NaN NaN 3]
but the give me a valid movmean value for this set of 10 values:
[1 3 2 4 NaN NaN 3 2 5 3]