Hi! I'm new to matlab and was wondering how to calculate a distance matrix between XY pairs from a GIS output (also has Z and a unique name). I'm trying to compute the distance matrix to start network analysis…

Here is what I have so far… I know I'm probably doing this wrong. Any help would be greatly appreciated! Am i using pdist correctly for this? I'm trying to find an alternative to the stock dist() function in R… and want to produce a matrix in meters after.

%%- load file, plot XYZ

data=xlsread('RiverNetworkNodesCSV.xlsx');

X = data(:,4); % relative, easting meters

Y = data(:,5); % relative northing, latitude, meters

Z = data (:,6); % elevation sampled from raster

scatter(X,Y)

D = pdist2(X,Y,'euclidean')

## Best Answer