2013-05-09 36 views
0

我正在使用MATLAB中的k-means。這裏是我的代碼:腳本寫入正確,圖形仍然不顯示

k=input('Enter a number: '); 
    [g c] = kmeans(cobat,k,'dist','SqEuclidean'); 
    y = [cobat g] 

    [s,h]=silhouette(cobat,g,'SqEuclidean') %Show the silhouette graphic 

    %Show the plot3D graphic 
    Colors=hsv(k); 
    PlotClusters(cobat,g,c,Colors) 

當我運行它,它的工作原理,但爲什麼[s,h]=silhouette(cobat,g,'SqEuclidean')無法顯示?

當我刪除這一行:

Colors=hsv(k); 
    PlotClusters(cobat,g,c,Colors) 

...可以示出的輪廓曲線圖。

我應該怎麼做才能顯示所有圖表?

您的幫助對我來說意義重大,謝謝。

回答

2

我不知道你的PlotClusters是做什麼的,但它可能會很好地寫入silhouette生成的相同數字,可能會覆蓋舊的情節。

嘗試帶來了與figure命令一個新的身影調用之前PlotClusters,像這樣:

figure 
Colors = hsv(k) 
PlotClusters(cobat,g,c,Colors) 
+1

它的工作。謝謝,Eitan! :) – 2013-05-10 22:00:16