Cody

Problem 2199. Pairwise Euclidean Distance

Given two matrices A,B of dimensions NxK and NxL respectively, calculate the pairwise euclidean distance of all vectors (columns). The result should be a matrix of dimensions KxL which contains all possible pairs of distances.

Example:

 pairEuc([1 2; 3 4]', [5 6; 7 8; 9 10]')
 ans =
    5.6569    8.4853   11.3137
    2.8284    5.6569    8.4853

Solution Stats

52.78% Correct | 47.22% Incorrect
Last solution submitted on May 12, 2016
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!

Join the 15-year community celebration.

Play games and win prizes!

Learn more