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

if nargin == 1
    y = prctilex(x,50);
else
    y = prctilex(x,50,dim);
end;

