function meanX = nanmean(X)
i = find(~isnan(X));
meanX = mean(X(i));