help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help-octave Digest, Vol 46, Issue 45


From: Chengqi Zhang
Subject: Re: Help-octave Digest, Vol 46, Issue 45
Date: Mon, 25 Jan 2010 18:32:08 +0800
User-agent: Opera Mail/10.10 (Win32)

On Mon, 25 Jan 2010 16:10:12 +0800, <address@hidden> wrote:

Hi All,

Would appreciate help cracking this:

I have two matrices of row vectors A ( n X d ) and B ( m X d ), n>m . In both matrices the vectors are binary, that is, each component is either 0 or 1.

What is an efficient way to find which vectors from B are already in A, for example, A( 2, : ) equals B( 4, : ) etc. For each row in B I need the corresponding row from A.

Thanks,
Mike.

I've found a simple solution. However, I've no idea whether there is a simpler one.
for r=m:-1:1
        myans{r}=find(all(repmat(B(1,:),n,1)==A,2));
end
--
Best Regards!
---------------------------
Sincerely,                      Chengqi Zhang
China Center for Economic Research
Mail: address@hidden
Personal Website: http://macro2.cn


reply via email to

[Prev in Thread] Current Thread [Next in Thread]