diff --git a/matlab/utilities/general/demean.m b/matlab/utilities/general/demean.m
index b9dda8d13161b3b2c3c153542aeccedd75feff60..dffd314443480bca2746462c7f4124a14a5e1cc0 100644
--- a/matlab/utilities/general/demean.m
+++ b/matlab/utilities/general/demean.m
@@ -44,12 +44,8 @@ function c = demean(x)
 % You should have received a copy of the GNU General Public License
 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 
-% Original author: stephane DOT adjemian AT univ DASH lemans DOT fr
+if ndim(x)>2
+    error('This function is not implemented for arrays with dimension greater than two!')
+end
 
-if ndim(x)==1
-    c = x-nanmean(x);
-elseif ndim(x)==2
-    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
+c = bsxfun(@minus, x, nanmean(x));
\ No newline at end of file