How to use kmeans() function ??..
显示 更早的评论
I am using kmeans() function as follows:
x = [1 2 3 7 3; 4 5 6 9 2; 7 8 9 12 3; 10 11 12 8 1; 13 14 15 12 7]
tdata = kmeans(x,3)
it is giving me following error:
Error using kmeans (line 46)
Data dimension does not match dimension of centres
Then I tried to do it as:
x = [1 2 3 7 3; 4 5 6 9 2; 7 8 9 12 3; 10 11 12 8 1; 13 14 15 12 7]
opts = statset('Display','final');
>> [idx,ctrs] = kmeans(X,2,...
'Distance','city',...
'Replicates',5,...
'Options',opts);
it is giving error as:
Error using kmeans
Too many input arguments.
I am unable to find where is the mistake.... I did the same as given in example in help.... Then why I am unable to do clustering??...
plz do guide me to figure it out and fix it....
回答(2 个)
Puru
2015-11-13
I had a similar problem. I tried using
which -all kmeans
and realised that there is the same function in "netlab" tool box, which was shadowing the "stats" toolbox "kmeans" function (the one I needed to use).
So i went to "set path" window (it should be in "home" menu), and removed the netlab from the directory (alternate way would be to move it below stats toolbox).
And it worked!!
Walter Roberson
2013-1-2
Please use
which -all kmeans
to check whether you have accidentally introduced another kmeans function.
Which MATLAB version are you using?
类别
在 帮助中心 和 File Exchange 中查找有关 k-Means and k-Medoids Clustering 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!