필터 지우기
필터 지우기

Script Writes Correctly, The Graph Still Doesn't Show Up

조회 수: 1 (최근 30일)
Alvi Syahrin
Alvi Syahrin 2013년 5월 9일
I'm working with k-means in MATLAB. And here is my code:
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)
When I run it, it works anyway, but why " [s,h]=silhouette(cobat,g,'SqEuclidean')" can't be shown?
When I deleted this line: Colors=hsv(k); PlotClusters(cobat,g,c,Colors)
The silhouette graph can be shown.
What should I do so all the graphs can be shown?
Your help means a lot to me, thank you.

채택된 답변

Matt Kindig
Matt Kindig 2013년 5월 9일
Call hold on after your silhouette() call. 'hold on' prevents the current axes from being cleared after each plotting command.
[s,h]=silhouette(cobat,g,'SqEuclidean') %Show the silhouette graphic
hold on;
%Show the plot3D graphic
Colors=hsv(k);
PlotClusters(cobat,g,c,Colors)
doc hold

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by