title: Why i get this following error when using dir in Matlab?
body: <p>Matlab keep give me following error message :</p>
  
  <p>??? Error using ==> dir
  Argument must contain a string.</p>
  
  <p>Error in ==> Awal at 15
      x = dir(subDirs)</p>
  
  <p>Below is my codes :</p>
  
  <pre><code>%MY PROGRAM
  
  clear all;
  clc;
  close all;
  
  %-----Create Database-----
  TrainDB = uigetdir('','Select Database Directory');
  TrainFiles = dir(TrainDB);
  dirIndex = [TrainFiles.isdir];
  [s subDirNumber] = size(dirIndex);
  for i = 3:subDirNumber
      subDirs = {TrainFiles(i).name};
      subDirs = strcat(TrainDB,'\',subDirs);
      x = dir(subDirs) %&lt;-------Error Here
  end
  </code></pre>
  
  <p>Is something wrong with the codes? Your help will be appreciated.
  I'm sorry for my bad English.</p>