medfilt1 [signal]
y = medfilt1(x [, n])

Apply a median filter of length n to the signal x.  A sliding window is
applied to the data, and for each step the median value in the window is
returned.  If n is odd then the window for y(i) is x(i-(n-1)/2:i+(n-1)/2).
If n is even then the window is x(i-n/2:i+n/2-1) and the two values in the
center of the sorted window are averaged. If n is not given, then 3 is used.
NaNs are ignored, as are values beyond the ends, by taking the median of
the remaining values.