MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Learn moreOpportunities for recent engineering grads.
Apply TodayNew to MATLAB?
MATLAB Central > MATLAB Newsreader > creating distance matrix 

I have two vectors, A and B, and I'd like to create a distance matrix C, that's its dims are numel(A) x numel(B), and C(i,j) is A(i)  B(j). It is simple to do it with loops, but I'd like to optimize it, as A and B are huge, and this calculation repeats many times. 
"Yoav Rubin" <yoavrubin@hotmail.com> wrote in message <gvo2ts$e2g$1@fred.mathworks.com>... 
"Yoav Rubin" <yoavrubin@hotmail.com> wrote in message <gvo2ts$e2g$1@fred.mathworks.com>... 
"John D'Errico" <woodchips@rochester.rr.com> wrote in message <gvo8lh$ogo$1@fred.mathworks.com>... 
"Gavrilo Bozovic" <gavrilo.dot.bozovic@gmail.dot.ch> wrote in message <gvopbt$fkt$1@fred.mathworks.com>... 
thanks, the bsxfun solved it perfectly 
No tags are associated with this thread.
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.