assign patterns to clusters

6 vues (au cours des 30 derniers jours)
Natasha Kratowska
Natasha Kratowska le 2 Sep 2012
Hello,
Consider two vectors 1xm, namely vector1 and vector2 and three other ones of the same size, namely v1, v2 and v3.
I calclulate the distances (which don`t have to be the Euclidean),
d(vector1,v1)
d(vector1,v2)
d(vector1,v3)
and
d(vector2,v1)
d(vector2,v2)
d(vector2,v3)
How can I assign the vector1 and vector2 to a cluster with the minimum distance to v1, v2 or v3?
For example,
IF d(vector1,v2).le.d(vector1,v1) AND d(vector1,v2).le.d(vector1,v3) THEN assign vector1 to cluster 2.
I don`t mind doing it with "if-then" or "for-end" or any function.
Thank you.
Best,
Natasha

Réponse acceptée

Walter Roberson
Walter Roberson le 2 Sep 2012
[mindist, minidx] = min([d(vector1,v1), d(vector1,v2), d(vector1,v3)], 2);
then minidx will be the cluster number.

Plus de réponses (0)

Catégories

En savoir plus sur Third-Party Cluster Configuration dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by