Plotting Clusters using attributes

2 次查看(过去 30 天)
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