title: Iteratively saving variables to files using Matlab save function
body: <p>I am saving the contents of an array to different files as follows:</p>
  
  <pre><code>for i=1:10
  name = [myfilename num2str(i)] 
  savevar = myvariable(i)
  filename = mat2str([name '.dat'])
  save(filename, savevar, '-ascii','-double','-append')
  end
  </code></pre>
  
  <p>I have been fiddling around with this for a while and keep getting the following error:</p>
  
  <pre><code>??? Error using ==&gt; save
  Argument must contain a string.
  </code></pre>
  
  <p>Where am I going wrong?</p>