diff --git a/matlab/utilities/general/demean.m b/matlab/utilities/general/demean.m index 741a2f107..b9dda8d13 100644 --- a/matlab/utilities/general/demean.m +++ b/matlab/utilities/general/demean.m @@ -47,9 +47,9 @@ function c = demean(x) % Original author: stephane DOT adjemian AT univ DASH lemans DOT fr if ndim(x)==1 - c = x-mean(x); + c = x-nanmean(x); elseif ndim(x)==2 - c = bsxfun(@minus,x,mean(x)); + c = bsxfun(@minus,x,nanmean(x)); else error('descriptive_statistics::demean:: This function is not implemented for arrays with dimension greater than two!') end \ No newline at end of file