[2261,582] [2261,716] [2261,904] [2261,2622] [2261,2802] find distance between [2261,2954] [206,789] [207,887] [219,1540] [235,2467] in matlab

main.m
% Define the coordinates as 2D array
coordinates = [2261,582; 2261,716; 2261,904; 2261,2622; 2261,2802;
               2261,2954; 206,789; 207,887; 219,1540; 235,2467];

% Calculate the pairwise Euclidean distance between the coordinates
d = pdist(coordinates,'euclidean');

% Reshape the result into a square matrix
numCoordinates = size(coordinates,1);
distanceMatrix = squareform(d(1:(numCoordinates*(numCoordinates-1)/2)));

% Display the distance matrix
distanceMatrix
474 chars
14 lines

The output will be a 10x10 matrix where each element represents the Euclidean distance between the corresponding pairs of coordinates.

gistlibby LogSnag