Clear Filters
Clear Filters

Plotting Clusters using attributes

2 views (last 30 days)
Alayt Abraham Issak
Alayt Abraham Issak on 11 Apr 2019
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)));

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!