Here is code which finds the median of just the finite values. Then, it backfills the nan values.
uMed(find(isfinite(u))) = medfilt1(u(isfinite(u)),100);
uMed(find(~isfinite(u))) = nan;
"Alex " <A.Jironkin@warwick.ac.uk> wrote in message <itg4do$28p$1@newscl01ah.mathworks.com>...
> I don't know if anyone still interested in it, but there is a function in MATLAB nanmedian() that fill filter out NaN.
uMed(find(isfinite(u))) = medfilt1(u(isfinite(u)),100);
uMed(find(~isfinite(u))) = nan;
"Alex " <A.Jironkin@warwick.ac.uk> wrote in message <itg4do$28p$1@newscl01ah.mathworks.com>...
> I don't know if anyone still interested in it, but there is a function in MATLAB nanmedian() that fill filter out NaN.