Mercurial > hg > octave-lyh
comparison scripts/set/setxor.m @ 9481:a3ae7abaf659
support cellstrs in setxor
author | Pieter Eendebak <pieter.eendebak@gmail.com> |
---|---|
date | Tue, 04 Aug 2009 09:33:33 +0200 |
parents | 1bf0ce0930be |
children | f7cc8f30f3b8 |
comparison
equal
deleted
inserted
replaced
9480:bca39c365fda | 9481:a3ae7abaf659 |
---|---|
69 endif | 69 endif |
70 else | 70 else |
71 na = numel (a); nb = numel (b); | 71 na = numel (a); nb = numel (b); |
72 [c, i] = sort ([a(:); b(:)]); | 72 [c, i] = sort ([a(:); b(:)]); |
73 n = length (c); | 73 n = length (c); |
74 idx = find (c(1:n-1) == c(2:n)); | 74 if (iscell (c)) |
75 idx = find (strcmp (c(1:n-1), c(2:n))); | |
76 else | |
77 idx = find (c(1:n-1) == c(2:n)); | |
78 endif | |
75 if (! isempty (idx)) | 79 if (! isempty (idx)) |
76 c([idx, idx+1]) = []; | 80 c([idx, idx+1]) = []; |
77 i([idx, idx+1]) = []; | 81 i([idx, idx+1]) = []; |
78 endif | 82 endif |
79 if (size (a, 1) == 1 || size (b, 1) == 1) | 83 if (size (a, 1) == 1 || size (b, 1) == 1) |