changeset 5090:c42c90543e36

[project @ 2004-12-03 04:32:11 by jwe]
author jwe
date Fri, 03 Dec 2004 04:32:11 +0000
parents 3db2b2762491
children 87b0b9a97e40
files scripts/ChangeLog scripts/statistics/base/moment.m
diffstat 2 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Fri Dec 03 04:06:05 2004 +0000
+++ b/scripts/ChangeLog	Fri Dec 03 04:32:11 2004 +0000
@@ -1,3 +1,7 @@
+2004-12-02  Balint Reczey  <balint_reczey@yahoo.com>
+
+	* statistics/base/moment.m: Fix argument parsing for N-d arrays.
+
 2004-11-09  John W. Eaton  <jwe@octave.org>
 
 	* miscellaneous/fileparts.m: Allow filenames with no extension.
--- a/scripts/statistics/base/moment.m	Fri Dec 03 04:06:05 2004 +0000
+++ b/scripts/statistics/base/moment.m	Fri Dec 03 04:32:11 2004 +0000
@@ -53,10 +53,10 @@
 
   need_dim = 0;
 
-  if (nargin == 1)
+  if (nargin == 2)
     opt = "";
     need_dim = 1;
-  elseif (nargin == 2)
+  elseif (nargin == 3)
     if (isstr (opt1))
       opt = opt1;
       need_dim = 1;
@@ -64,7 +64,7 @@
       dim = opt1;
       opt = "";
     endif
-  elseif (nargin == 3)
+  elseif (nargin == 4)
     if (isstr (opt1))
       opt = opt1;
       dim = opt2;
@@ -78,9 +78,6 @@
     usage ("moment (x, p, dim, opt) or moment (x, p, dim, opt)");
   endif
 
-  sz = size(x);
-  n = sz (dim);
-
   if (need_dim)
     t = find (size (x) != 1);
     if (isempty (t))
@@ -93,7 +90,7 @@
   sz = size (x);
   n = sz (dim);
 
-  if (numels (x) < 1)
+  if (numel (x) < 1)
     error ("moment: x must not be empty");
   endif