title: How to read files in a folder that isn't the current folder?
body: <p>I'm making a program which need a reference folder with <code>.txt</code> files inside. Those files are read automatically. In the next step, the user is asked to choose a file and the program will read the specified file.</p>
  
  <p>The thing is, I want the reference to be in a different folder (which will stay the same). If my current folder is the one containing the user's data, how can I read my reference files?</p>
  
  <p>Here's the codeline for the automatic file opening part, as it is right now :</p>
  
  <pre><code>fichierref = 'H:\MATLAB\Archive_08112012';
  files = dir(fullfile(fichierref, '*.txt'));
  numberOfFiles = numel(files);
  for d = 1:numberOfFiles
     filenames(d) = cellstr(files(d).name);
  end
  </code></pre>
  
  <p>It does open the files automatically, but only if my current folder is the Archive_08112012.</p>
  
  <p>EDIT:</p>
  
  <p>I'll add this. This is how I open the files.</p>
  
  <pre><code>headerlinesIn = 11;
  delimiterIn=' ';
  if numberOfFiles &gt; 1
  for i=1:numberOfFiles
       data = importdata(filenames{i},delimiterIn,headerlinesIn);
  </code></pre>
  
  <p>It has exactly the same line if numberOfFiles = 1, but there is no for loop.</p>