Mercurial > octave-nkf
changeset 9481:a3ae7abaf659
support cellstrs in setxor
author | Pieter Eendebak <pieter.eendebak@gmail.com> |
---|---|
date | Tue, 04 Aug 2009 09:33:33 +0200 |
parents | bca39c365fda |
children | fb22dd5d6242 |
files | scripts/ChangeLog scripts/set/setxor.m |
diffstat | 2 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog Mon Aug 03 15:53:30 2009 +0200 +++ b/scripts/ChangeLog Tue Aug 04 09:33:33 2009 +0200 @@ -1,3 +1,7 @@ +2009-08-04 Pieter Eendebak <pieter.eendebak@gmail.com> + + * set/setxor.m: Support cell arrays of strings. + 2009-08-03 Jaroslav Hajek <highegg@gmail.com> * general/sub2ind.m: Remove source.
--- a/scripts/set/setxor.m Mon Aug 03 15:53:30 2009 +0200 +++ b/scripts/set/setxor.m Tue Aug 04 09:33:33 2009 +0200 @@ -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]) = [];