how can I let the string variable change in a loop
조회 수: 2 (최근 30일)
이전 댓글 표시
Dear fellows,
I am trying to plot the scatter for a set of vectors. My secource file pf.mat is a 65*154 matrix. I want to plot two columns each time so I am writing a loop (i=1:77)from 1 to 77. In each loop, after plot the vectors, I would to save the image as the number of the i. My questions is how do I name the image then it can change as th loop goes on? My current code only can save the image as the letter i, but not the actual number of i. Here is my code
if true
% load pf
for i=1:77
scatter(pf(:,(2*i-1)),pf(:,2*i),'.')
hold on
plot([0,100],[100,0])
h(i)=scatter(pf(:,(2*i-1)),pf(:,2*i),'.');
saveas(h(i),'i', 'pdf')
end end
댓글 수: 0
채택된 답변
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!