How to compute the Euclidean Distance separately by using pdist function?
Mostrar comentarios más antiguos
Hi everyone, I got a question when using pdist, it would be so many thanks if you could give me some advice. The pdist(D) usually gives the sum of the distance for the multiple dimension, however, I want to get the distance separately. For example I have a data set S which is a 10*2 matrix , I am using pdist(S(:,1)) and pdist(S(:,2)) to get the distance separately, but this seems very inefficient when the data has many dimensions. Is there any alternative way to achieve this more efficient? Thanks in advance!
Respuestas (1)
Image Analyst
el 19 de Nov. de 2017
Use pdist2():
allDistances = pdist2(S, S);
1 comentario
Zhida DENG
el 19 de Nov. de 2017
Categorías
Más información sobre k-Means and k-Medoids Clustering en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!