title: Import 40 spread sheets using for loop
body: <p>The code below is a minimal working example of my problematic code. There are actually 40 spreadsheets I need to import. The code is working except that the variables <code>herfs</code>, <code>gamma</code> and <code>vs</code> are being overwritten on each loop. I need a way to index the variables so that the data does not keep getting overwritten.</p>
  
  <pre><code>s.AUS=1;
  s.AUT=2;
  s.USA=39;
  s.IND=40;
  fn=fieldnames(s);
  for y = fn'
      file = str2mat(strcat(y,'_herf'));
      herfs = xlsread(file, 'herf');
      gamma = xlsread(file, 'gamma');
      vs = xlsread(file, 'v');
  end
  </code></pre>