Mercurial > hg > octave-nkf
changeset 4317:1ced186d4b6b
[project @ 2003-02-11 16:10:09 by jwe]
author | jwe |
---|---|
date | Tue, 11 Feb 2003 16:10:09 +0000 |
parents | 236c10efcde2 |
children | 115bffcecfd3 |
files | scripts/ChangeLog scripts/set/union.m |
diffstat | 2 files changed, 14 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2003-02-11 Paul Kienzle <pkienzle@users.sf.net> + + * set/union.m: Preserve the orientation of inputs. + 2003-01-23 John W. Eaton <jwe@bevo.che.wisc.edu> * general/int2str.m: Eliminate leading spaces.
--- 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