Clustered 3D scatterplot with kmeans

1 view (last 30 days)
Mehmet Volkan Ozdogan
Mehmet Volkan Ozdogan on 22 Mar 2019
hi,
I have a set of xyz,
and i want to plot the scatterplot of 3D data with clustering and then i want to find the mean of each clustered data by k-means
I wrote the code below but it is not working. it is for 150 cluster. What will be the problem. I think the problem is about "scatter3(xyz(:,1),xyz(:,2),xyz(:,3), idx,'bgm')"
Thank you
x=xlsread('kesit3D.xlsx', 'A:A');
y=xlsread('kesit3D.xlsx', 'B:B');
z=xlsread('kesit3D.xlsx', 'C:C');
xyz=[x y z];
[idx,C] = kmeans(xyz,150);
figure
scatter3(xyz(:,1),xyz(:,2),xyz(:,3), idx,'bgm')
hold on
plot(C(:,1),C(:,2),C(:,3),'kx')
disp(C)

Answers (0)

Community Treasure Hunt

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

Start Hunting!