Using a loop to add a new point to a figure at each constant rate
<p>I am trying to plot figures that have a point inside it. I want to add a new point to the figure at each <code>10</code> steps (or any constant rate).For example, if I have <code>50</code> steps then I should have <code>50</code> figures. Figures from <code>1</code> to <code>10</code> will have one point, figures from <code>11</code> to <code>20</code> will have two points, and figures from <code>21</code> to <code>30</code> will have three points, and so on. I did that in the below code  but, unfortunately, it gave me only one point for all figures. </p>

<pre><code>clc;
clear;
Current_Path=pwd;
cd (Current_Path)
mkdir('Photos','part1')
pridir = 'Photos\part';
R=rand(1,50);
Y=rand(1,50);
for i=1:50
    figure
    for jj = 1:floor((i-1)/10)+1
        if jj&lt;=1
            plot (R(i),Y(i),'*r');
            printto = sprintf('%s%d\\Motion%03d',pridir,1,i);
            print('-djpeg90',printto)
            close(gcf);
            hold on
        else
            R(i)=R(i-((jj-1)*10));
            Y(i)=Y(i-((jj-1)*10));
            plot (R(i),Y(i),'*r');
            printto = sprintf('%s%d\\Motion%03d',pridir,1,i);
            print('-djpeg90',printto)
            close(gcf);
            hold on
        end
    end
    hold off
end
</code></pre>