For loop within a for loop doesn't quite work!
古いコメントを表示
I have this for loop inside a for loop which I've created to develop a scatter plot and it almost works, except after the first iteration it seems to only be looping back via the second loop and ignoring the first one each time. How do I prevent that and make sure it loops with the first, then second, then first then second etc?
fig = figure();
x = T2{:,10};
for i = 2:9
y = T2{:,i};
for j = 1:6;
axj = subplot(2,3,j);
scatter(axj,x,y,'filled');
end;
end;
Thank you!!
1 件のコメント
Olivia Milton-thompson
2015 年 10 月 15 日
回答 (1 件)
Walter Roberson
2015 年 10 月 15 日
0 投票
You need "hold on" after the first scatter() call
2 件のコメント
Olivia Milton-thompson
2015 年 10 月 15 日
Olivia Milton-thompson
2015 年 10 月 15 日
編集済み: Olivia Milton-thompson
2015 年 10 月 15 日
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!