assign patterns to clusters
조회 수: 7 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
Walter Roberson
2012년 9월 2일
[mindist, minidx] = min([d(vector1,v1), d(vector1,v2), d(vector1,v3)], 2);
then minidx will be the cluster number.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Third-Party Cluster Configuration에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!