diff scripts/set/union.m @ 4317:1ced186d4b6b

[project @ 2003-02-11 16:10:09 by jwe]
author jwe
date Tue, 11 Feb 2003 16:10:09 +0000
parents f8dde1807dee
children c08cb1098afc
line wrap: on
line diff
--- a/scripts/set/union.m
+++ b/scripts/set/union.m
@@ -39,16 +39,17 @@
     usage ("union(a,b)");
   endif
 
-  if(isempty(a))
-    y = create_set(b);
-  elseif(isempty(b))
-    y = create_set(a);
+  if (isempty (a))
+    y = create_set (b);
+  elseif (isempty (b))
+    y = create_set (a);
   else
-    [nra, nca] = size(a);
-    a = reshape(a,1,nra*nca);
-    [nrb, ncb] = size(b);
-    b = reshape(b,1,nrb*ncb);
-    y = create_set([a, b]);
+    y = create_set ([a(:); b(:)]);
+    if (size (a, 1) == 1 || size (b, 1) == 1)
+      y = y(:).';
+    else
+      y = y(:);
+    endif
   endif
 
 endfunction