title: save figures in matlab during loop
body: <p>I am interested if it is possible to save figures which occurs during the loop.<br>
  For example, I have created some random matrix,</p>
  
  <pre><code> r=rand(8,5)
  
  
  r =
  
  0.8147    0.9575    0.4218    0.6787    0.2769
  0.9058    0.9649    0.9157    0.7577    0.0462
  0.1270    0.1576    0.7922    0.7431    0.0971
  0.9134    0.9706    0.9595    0.3922    0.8235
  0.6324    0.9572    0.6557    0.6555    0.6948
  0.0975    0.4854    0.0357    0.1712    0.3171
  0.2785    0.8003    0.8491    0.7060    0.9502
  0.5469    0.1419    0.9340    0.0318    0.0344
  </code></pre>
  
  <p>now if I use  this  line</p>
  
  <pre><code>plot(r(1,:))
  </code></pre>
  
  <p>I get following figure</p>
  
  <p><img src="https://i.stack.imgur.com/JtzWg.jpg" alt="enter image description here"></p>
  
  <p>My question is, if I use loop</p>
  
  <pre><code>for i=1:8
     plot(r(i,:))
  end
  </code></pre>
  
  <p>it shows me one graph of  row, but it odes not do cycle, so can I show all  8  figures  step by step in matlab. For exmaple interval may be 10 seconds, for this as I know function <code>movie</code> is used, also <code>getframe</code>, or could I save figures in loop?<br>
  Also, I know that imsave or something like this. I think better would be  save somewhere, so if I can use  like this</p>
  
  <pre><code>imsave(plot(r(i,:))
  </code></pre>