Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Is this function available?
Date: Sun, 7 Dec 2008 00:35:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 23
Message-ID: <ghf5nn$arc$1@fred.mathworks.com>
References: <852406.1228600170649.JavaMail.jakarta@nitrogen.mathforum.org> <ghetde$km4$1@fred.mathworks.com> <ghf0b6$l55$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1228610103 11116 172.30.248.38 (7 Dec 2008 00:35:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 7 Dec 2008 00:35:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:505417


"David Doria" <daviddoria@gmail.com> wrote in message <ghf0b6$l55$1@fred.mathworks.com>...
> Roger, I feel like he is talking more about the intersection of the column spaces, not a discrete kind of intersection. Intersect() will just say that two things intersect if they are exactly the same, right? Where the vector spaces intersect in a much more complicated way.
> I could be way off...
> Dave

  Here is a quote from the Matlab 7 Function Reference, Vol. 2: "c = intersect(A, B, 'rows') when A and B are matrices with the same number of columns returns the rows common to both A and B."  With a transpose understood, you can read that with the words 'rows' and 'columns' interchanged.  Nothing is said about the matrices being the same size, only their respective numbers of columns (which translates to rows with the transpose).

  For example, if

 A = [1 2 3 4 5;6 7 8 9 10;11 12 13 14 15] 

and

 B = [5 16 2;10 17 7;15 18 12] 

then C could be calculated as

 C = intersect(A',B','rows')' = [2 5;7 10;12 15].

I presume from the OP's description, since A and B share two columns in common, that C should consist of just these two columns.

Roger Stafford