view scripts/set/union.m @ 1684:f85887dfe06c

[project @ 1995-12-30 03:46:07 by jwe]
author jwe
date Sat, 30 Dec 1995 03:51:15 +0000
parents 3470f1e25a79
children 5cffc4b8de57
line wrap: on
line source

function y = union(a,b)

# usage: union(a,b)
#
# Returns the union of sets a and b.
#
# See - create_set, intersection, complement

  if (nargin != 2)
    usage ("union(a,b)");
  endif

  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]);
  endif

endfunction