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: Mike B.
Subject: Re: Help-octave Digest, Vol 46, Issue 45
Date: Mon, 25 Jan 2010 17:13:52 -0800 (PST)

Thanks for replying Chengqi.
ismember does I want .
Cheers.

--- On Mon, 25/1/10, Chengqi Zhang <address@hidden> wrote:

From: Chengqi Zhang <address@hidden>
Subject: Re: Help-octave Digest, Vol 46, Issue 45
To: address@hidden
Cc: address@hidden
Date: Monday, 25 January, 2010, 9:32 PM

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


New Email names for you!
Get the Email name you've always wanted on the new @ymail and @rocketmail.
Hurry before someone else does!
reply via email to

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