changeset 436:f3e55bdcd78e

Handle 2D data properly
author hauberg
date Wed, 20 Oct 2010 20:07:43 +0000
parents 8b58472d87e8
children 578e8a22a921
files inst/corr2.m
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/inst/corr2.m
+++ b/inst/corr2.m
@@ -35,13 +35,14 @@
     print_usage ();
   endif
 
-  if !(ismatrix(I) && isreal(I) && ismatrix(J) && isreal(J))
-	error("corr2: argument must be a real type matrix");
+  if (!(ismatrix (I) && isreal (I) && ismatrix (J) && isreal (J)))
+	error ("corr2: argument must be a real type matrix");
   endif
 
-  if (size (I) != size (J))
-    error("corr2: arguments must be of same size")
+  if (!size_equal (I, J))
+    error ("corr2: arguments must be of same size")
   endif
   
-  r = cov (I, J) / (std2(I)*std2(J));
+  r = cov (I (:), J (:)) / (std2 (I) * std2 (J));
 endfunction
+