Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: euclidean distance
Date: Tue, 30 Jun 2009 19:31:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 10
Message-ID: <h2dp5l$p98$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1246390261 25896 172.30.248.37 (30 Jun 2009 19:31:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 30 Jun 2009 19:31:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1821570
Xref: news.mathworks.com comp.soft-sys.matlab:551803


Hi everyone!
Im trying to calculate the euclidean distance between 2 matrices that contain 3d points.The matrices are quite large,eg A=19500x3 and B=2000x3.I want to calculate the distance between each point of A to each point of B and thus produce a 19500x2000 matrix.So far i wrote this but it takes like forever..Is there any faster way???

for i=1:size(A,1);
    for k=1:size(B,1);
Eucl_Ideal(i,k)=norm(A(i,:)-B(k,:));
    end 
end

Thank you in advance!!!!