title: Octave: Load all files from specific directory
body: <p>I used to have Matlab and loaded all txt-files from directory "C:\folder\" into Matlab with the following code:</p>
  
  <pre><code>myFolder = 'C:\folder\';
  filepattern = fullfile(myFolder, '*.txt');
  files = dir(filepattern);
  for i=1:length(files)
  eval(['load ' myFolder,files(i).name ' -ascii']);
  end
  </code></pre>
  
  <p>If C:\folder\ contains A.txt, B.txt, C.txt, I would then have matrices A, B and C in the workspace.</p>
  
  <p>The code doesn't work in octave, maybe because of "fullfile"?. Anyway, with the following code I get matrices with the names C__folder_A, C__folder_B, C__folder_C. However, I need matrices called A, B, C.</p>
  
  <pre><code>myFolder = 'C:\folder\';
  files = dir(myFolder);
  for i=3:length(files)
  eval(['load ' myFolder,files(i).name ' -ascii']);
  end
  </code></pre>
  
  <p>Can you help me?
  Thanks,
  Martin</p>
  
  <p>PS: The loop starts with 3 because files(1).name = . and files(2).name = ..</p>
  
  <p>EDIT:
  I have just found a solution. It's not elegant, but it works.
  I just add the path in which the files are with "addpath", then I don't have to give the full name of the directory in the loop.</p>
  
  <pre><code>myFolder = 'C:\folder\';
  addpath(myFolder)
  files = dir(myFolder);
  for i=3:length(files)
  eval(['load ' files(i).name ' -ascii']);
  end
  </code></pre>