title: MATLAB newbie: problem reading in file when the file name is stored in a string
body: <p>I am using Matlab to read in and process calculation results.  I use fopen.</p>
  
  <p>My problem is that I currently have to specify a path to each file each time I need to use it in my processing code.  For example, this works:</p>
  
  <pre><code>fid = fopen('/Users/me/Desktop/Result1/velocity.tbl', 'r+');
  liqmass = textscan(fid, '%f %*f %*f %*n %f %*n %*n %*n %*n %*n %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f', 'headerlines', 1, 'delimiter', ',', 'CollectOutput', 1);
  fclose(fid);
  </code></pre>
  
  <p>But I want to do this:</p>
  
  <pre><code>velocityOut = '/Users/me/Desktop/Result1/velocity.tbl';  % Specify a path once in an easy-to-reach place
  fid = fopen(velocityOut, 'r+');
      liqmass = textscan(fid, '%f %*f %*f %*n %f %*n %*n %*n %*n %*n %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f %*f', 'headerlines', 1, 'delimiter', ',', 'CollectOutput', 1);
      fclose(fid);
  </code></pre>
  
  <p>However, I get the following error:
  ??? Undefined function or variable 'velocityOut'.</p>
  
  <p>I can't figure out why it isn't working.  I would be very grateful if someone could point out my mistake.  Thank you.</p>