How to use kmeans() function ??..
3 次查看(过去 30 天)
显示 更早的评论
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....
0 个评论
回答(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!!
0 个评论
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?
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!