I am attempting a K means cluster and so far, when I run this program, nothing is showing up on my graph. Can someone help me out?
1 次查看(过去 30 天)
显示 更早的评论
% An example database chosen
A = load('Image.mat');
A = A.Image;
% Data between 0 and 1
X = (A-min(A(:))) ./ (max(A(:) - min(A(:))));
% Normalize data
figure;
% Plot 2-D data
plot(X(:,1), X(:,2), '.');
title('Data');
% K Means (All on Mathworks)
dist_k = 'sqeuclidean'; % Distance
opts = statset('Display','off');
% If replicates = r > 1 and Start is plus (default), then the software
[idx,C, sumd,D] = kmeans(X,4,'Distance',dist_k,'Replicates',5,'Options',opts);
2 个评论
the cyclist
2018-6-4
编辑:the cyclist
2018-6-4
Can you upload the file Image.mat, so we have the data and can run your code?
采纳的回答
the cyclist
2018-6-4
Let's start with the simplest possibility ...
Do you realize that your code does not have a line in it that will plot the clusters? It only has code that will calculate the cluster indices.
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!