title: How do I pass a string as a function argument in MATLAB?
body: <p>Basically, I have 10 data files and I wrote a MATLAB function to process these data.
  The code is like this:</p>
  
  <pre><code>function Z = fitdata(file_path)
  
    A = importdata(file_path,',');
    ...
  
  end
  </code></pre>
  
  <p>Since I don't want to input the same command 10 times (for different file names), I wrote another script to automate this processing. The code looks like this:</p>
  
  <pre><code>function X = automate()
  
    myarray = {'file_one', 'file_two', 'file_three',......,'file_ten'};
    for i = 1:9
      mypath = myarray{i};
      W = fitdata(mypath);
      ...
    end
  
  end
  </code></pre>
  
  <p>But I'm getting the error "Too many input arguments" at the call to the fitdata(file_path) function.</p>
  
  <p>How should I do this?</p>