loop not executing
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
i have posted the code below ,the k means is plotted for 1st figure remaining 91 figures r white ,k means is noot plotted.please help
X=[out;out1111]
opts = statset('Display','final');
[idx,ctrs]=kmeans(X,10,'Distance','city','Replicates',5,'Options',opts)
v=size(idx)
b=size(ctrs)
for i=1:10
for j=1:10
figure,
plot(X(idx==i,j),X(idx==i,j),'r.','MarkerSize',16)
hold on;
plot(X(idx==i+1,1),X(idx==i+1,2),'b.','MarkerSize',16)
plot(X(idx==i+2,2),X(idx==i+2,3),'g.','MarkerSize',16)
legend('DBLCL','CLL','FLL')
outSS=d1(:,1);
outDD=d1(:,2);
for nn = 1:92
figure,
xlabel(['resp ', num2str(outSS(nn))]);
ylabel(['resp ', num2str(outDD(nn))]);
end
end
end
0 commentaires
Réponses (1)
Walter Roberson
le 8 Nov 2011
You have
for i = 1:10
for j = 1:10
figure
... do some plotting inside that figure ...
for nn = 1 : 92
figure
... put up two labels
end
end
end
You are thus asking for 10 * 10 + 10 * 10 * 92 figures (total 9300 figures) to be created, and all you are doing with 9200 of them is to put up two labels.
I think you need to reconsider your logic.
2 commentaires
Walter Roberson
le 9 Nov 2011
I matched the "end" statements in the original code carefully. In the original code, the "for nn = 1:92" is _inside_ the i and j loops.
Using your adjusted code, the figure() calls you use in the "for nn" loop will generate _different_ figures than the figure() call in the "for i" / "for j" nested loop.
You say that you need to label the axes for the 100 graphs generated, but you only generate xlabel() and ylabel() for 92 graphs. Why is that?
Anyhow...
outSS=d1(:,1);
outDD=d1(:,2);
for i=1:10
for j=1:10
figure,
plot(X(idx==i,j),X(idx==i,j),'r.','MarkerSize',16)
hold on;
plot(X(idx==i+1,1),X(idx==i+1,2),'b.','MarkerSize',16)
plot(X(idx==i+2,2),X(idx==i+2,3),'g.','MarkerSize',16)
legend('DBLCL','CLL','FLL')
nn = (i-1)*10 + j;
if nn <= 92
xlabel(['resp ', num2str(outSS(nn))]);
ylabel(['resp ', num2str(outDD(nn))]);
end
end
end
though again I don't see where the 92 vs 100 is supposed to fit in.
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!