Mercurial > hg > octave-lyh
changeset 9924:d0d6ff39db54
simplify ismember
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Sat, 05 Dec 2009 21:54:21 +0100 |
parents | 31d644253380 |
children | 955035efb929 |
files | scripts/ChangeLog scripts/set/ismember.m |
diffstat | 2 files changed, 5 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2009-12-05 Jaroslav Hajek <highegg@gmail.com> + + * set/ismember.m: Simplify. + 2009-12-03 John W. Eaton <jwe@octave.org> * audio/wavwrite.m: Delete generated a.wav file after each test.
--- a/scripts/set/ismember.m +++ b/scripts/set/ismember.m @@ -98,31 +98,19 @@ [s, is] = sort (s); endif - ## sort out NaNs + ## sort out NaNs in table if (isreal (s) && ! isempty (s) && isnan (s(end))) s = s(1:end - sum (isnan (s))); endif - if (isreal (a)) - anan = isnan (a); - a(anan) = 0; - endif - if (nargout > 1) a_idx = lookup (s, a, "m"); tf = logical (a_idx); if (! isempty (is)) a_idx(tf) = is (a_idx(tf)); endif - if (isreal (a)) - tf(anan) = false; - a_idx(anan) = 0; - endif else tf = lookup (s, a, "b"); - if (isreal (a)) - tf(anan) = false; - endif endif elseif (nargin == 3 && strcmpi (rows_opt, "rows"))