//-----------------------------------------------------------read from files
fid=fopen('F://CleancustomerTweetsNum.txt','r');
best_data=[];
while 1
tline=fgetl(fid);
if ~ischar(tline),break;end
tline=str2num(tline);
best_data=[best_data;tline];
end
fclose(fid);
//k-mean
subplot(1,2,1)
plot(x,y,'ok','MarkerFaceColor','k')
data2=[x,y];
IDX=kmeans(data2,2);
subplot(1,2,2)
scatter(x,y,50,IDX,'filled')
Matlab read data from txt file and then cluster data using K-means
最新推荐文章于 2024-09-28 22:35:00 发布