pdist computes pairwise distance between pairs of objects in m-by-n data matrix in MATLAB.
pdist computes Euclidean distance between pairs of objects in m-by-n data matrix in matlab.
Syntax
D = pdist(X)
D = pdist(X,distance)
Where, X is m-by-n data matrix.
- In
D = pdist(X)
, the calculated distance is Euclidean distance. - In
D = pdist(X,distance)
, the method can be specified bydistance
, which can be any one of the following
'euclidean' 'seuclidean' 'cityblock' 'minkowski' 'chebychev' 'mahalanobis' 'cosine' 'correlation' 'spearman' 'hamming' 'jaccard'
or any custom distance function of form d2 = distfun(XI,XJ)
You should use this tag if your question is related to the use of pdist or any custom distance functions associated with it.