Question about k means clustering

Hi there,
After you have clustered data, how can you find out or get a print out of what cluster each point has been assigned to?
For example if I cluster this simple data, how can I find out which cluster each data point belongs to
X = [randn(100,2)+ones(100,2);...
randn(100,2)-ones(100,2)];
opts = statset('Display','final');
[idx,ctrs] = kmeans(X,2,...
'Distance','city',...
'Replicates',5,...
'Options',opts);
plot(X(idx==1,1),X(idx==1,2),'r.','MarkerSize',12)
hold on
plot(X(idx==2,1),X(idx==2,2),'b.','MarkerSize',12)
Thank you

 채택된 답변

bym
bym 2011년 11월 17일

0 개 추천

Isn't it the
idx
variable which you have plotted in different colors?

추가 답변 (1개)

John
John 2011년 11월 17일

0 개 추천

Yes it is! Thanks

카테고리

도움말 센터File Exchange에서 Cluster Analysis and Anomaly Detection에 대해 자세히 알아보기

태그

질문:

2011년 11월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by