title: The eval function
body: <p>I am trying to learn MATLAB on my own. In the book I am using there is a script example involving <code>eval</code> which is as follows:</p>
  
  <pre><code> t = [0:0.1:2]
   for k = 1:10
      outputfile = ['result',int2str(k)];
      theta = k*pi*t;
      x = sin(theta);
      y = cos(theta);
      z = x.*y.^2;
      eval(['save ',outputfile,' x y z'])
  end
  </code></pre>
  
  <p>My questions is - why is it necessary to include <code>' x y z'</code> at the end of the <code>eval</code> command? I tried running this script without including this, and, as far as I can tell, the script looks to behave exactly the same (at least I can't find any difference).</p>
  
  <p>If anyone can explain to me why this is included, I would greatly appreciate it!</p>