Path: news.mathworks.com!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Re: quick search of a binary array within a binary matrix. Date: Tue, 31 May 2011 01:40:05 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 15 Message-ID: <is1gtl$ao4$1@newscl01ah.mathworks.com> References: <is0oum$e82$1@newscl01ah.mathworks.com> <1f65bbd9-a072-4c94-a008-074edf3d3699@w21g2000yqm.googlegroups.com> <is0uio$r70$1@newscl01ah.mathworks.com> <is168a$fk2$1@newscl01ah.mathworks.com> Reply-To: <HIDDEN> NNTP-Posting-Host: www-01-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: newscl01ah.mathworks.com 1306806005 11012 172.30.248.46 (31 May 2011 01:40:05 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Tue, 31 May 2011 01:40:05 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1187260 Xref: news.mathworks.com comp.soft-sys.matlab:729395 "Roger Stafford" wrote in message <is168a$fk2$1@newscl01ah.mathworks.com>... > .......... > One thing is certain. The code > > tmp=find(b*B'==sum(b)); > > will not get the answer you seem to be asking for by an conceivable stretch of the imagination. > > Roger Stafford - - - - - - - - - It has occurred to me that by "b is contained in B" you might have meant that at least one of the rows of B (after being converted to a matrix) has the property that each of its binary bits is a 1 wherever the corresponding b vector has a 1 - that is, that a 1 denotes membership in the set of possible columns indices - rather than that the two rows are bit-for-bit equal. If the former was your meaning of 'contained in', then the matrix multiplication you mentioned would indeed work properly. My comment about that is twofold. I think you should have used a better way of wording your problem than just "contained in", and I needed a greater "stretch of the imagination". Roger Stafford