Mercurial > hg > octave-lojdl
changeset 12054:e868e6276b5c release-3-2-x
support cellstrs in setxor
author | Pieter Eendebak <pieter.eendebak@gmail.com> |
---|---|
date | Thu, 06 Aug 2009 07:32:53 +0200 |
parents | 1740ac0eb9c2 |
children | c663c1a78c4a |
files | scripts/ChangeLog scripts/set/setxor.m |
diffstat | 2 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2009-08-04 Pieter Eendebak <pieter.eendebak@gmail.com> + + * set/setxor.m: Support cell arrays of strings. + 2009-08-05 Olli Saarela <olli.saarela@gmail.com> * plot/__gnuplot_get_var__.m: If read fails to return data, sleep
--- a/scripts/set/setxor.m +++ b/scripts/set/setxor.m @@ -71,7 +71,11 @@ na = numel (a); nb = numel (b); [c, i] = sort ([a(:); b(:)]); n = length (c); - idx = find (c(1:n-1) == c(2:n)); + if (iscell (c)) + idx = find (strcmp (c(1:n-1), c(2:n))); + else + idx = find (c(1:n-1) == c(2:n)); + endif if (! isempty (idx)) c([idx, idx+1]) = []; i([idx, idx+1]) = [];