필터 지우기
필터 지우기

Plotting Clusters using attributes

조회 수: 2 (최근 30일)
Alayt Abraham Issak
Alayt Abraham Issak 2019년 4월 11일
I'm trying to plot a clusters using the code below. The attribs are initially = [1 2 3], however as I attempt to change it to [60 61 62] it says ' Index exceeds the number of array elements'.
I dont understand this because when I run the code with [1 2 3] it outputs a cluster plot with columns 1, 2, 3 from my table/data. And so, because I to create clusters from columns [60 61 62], I dont understand why it would output an exceeeding error.
figure(1)
colstyle = {'cs','rd','b^','go','k+','d',':bs','-mo'}; %define 8 color/style combos for this plot
attribs=[60 61 62]; %categories for x, y, and z axes
for j=1:k
q=find(clust==j); %ID numbers of the items in this cluster
nsample(j)=length(q); %Sample size in the cluster
debt(j)=mean(B_train(q)); %Survival rate within this cluster
plot3(A_train(q,attribs(60)),A_train(q,attribs(61)),A_train(q,attribs(62)),colstyle{j}) % 3-D plot with marker types by cluster
hold on
end
hold off
legend('Cluster 1','Cluster 2','Cluster 3','Cluster 4','Cluster 5','Cluster 6','Cluster 7','Cluster 8');
xlabel(all_factors(attribs(60)));
ylabel(all_factors(attribs(61)));
zlabel(all_factors(attribs(62)));

답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by