function m = nanmedian(x,dim)
%NANMEDIAN Median value, ignoring NaNs.

m=median(x(~isnan(x),:),dim);

