title: Looping through an array of strings in Matlab
body: <p>I'm trying to just loop through some folders using a list of strings in Matlab and everything I've tried hasn't worked. </p>
  
  <p>For instance, if I had three names, all I'd want is to loop through some folders like this:</p>
  
  <pre><code>names = ['Tom', 'Dick', 'Harry']
  
  SourceDir = /path/to/my/files
  
  for name = 1:length(names)
  
      mkdir SourceDir, "/things_belonging_to_", names(name), "/new_things"
      OutputDir = (SourceDir, "/things_belonging_to_", names(name), "/new_things")
  
      cd "/things_belonging_to_", names(name), "/oldthings"
  
      % do other stuff that will be dumped in OutputDir
  
  end
  </code></pre>
  
  <p>I've tried using <code>{}</code> instead of <code>[]</code>, I tried to use <code>sprintf</code> and <code>fullfile</code>. All I want is a really boring for-loop and I cannot seem to find/understand the documentation that shows me how to use strings in the <code>mkdir</code> or <code>cd</code> command. I always end up with <code>string input not supported</code> or <code>Arguments must contain a character vector</code>.</p>