Date: Jan 21, 2013 8:06 AM
Author: Bruno Luong
Subject: Re: Problem using horzcat with index vectors in a for loop
"Thomas " <thomas.seers@postgrad.manchester.ac.uk> wrote in message <kdhu6v$o6p$1@newscl01ah.mathworks.com>...

> Hi

> I am trying to horizontally concatenate identical rows identified from two matrices using index vectors obtained using intersect: E.g.

> A =

> 2 4

> 5 7

> 2 8

> 3 1

> 8 4

> B =

> 5 7

> 2 4

> 2 2

> 8 4

> 3 1

> [C,ia,ib] = intersect(A,B,'rows', 'legacy');

> C =

>

> 2 4

> 3 1

> 5 7

> 8 4

> ia =

> 1

> 4

> 2

> 5

>

> ib =

> 2

> 5

> 1

> 4

>

> So I want to use the vector indices (ia / ib) to horizontally concatenate the matched rows found using intersect. E.g. for the first identified row this would be:

> D = horzcat(A(ia(1),:), B(ib(1),:))

Please post your whole code (with ismember) and short example of desired output. It sounds like you just concatenate two times C together.

Bruno