title: How to pass filepath variables to mex command?
body: <p>Currently trying to create a minimal example of scripted mex file generation.</p>
  
  <p>I have a MATLAB .m script that I am running to generate mex files. I would like to pass in all the arguments as variables so that I can automate a bunch of mex file construction when given a list of filenames/paths.</p>
  
  <pre><code>#1 : unknown argument -outdir
  input = ' -outdir C:/Users/ian/mexTesting/mexFiles'
  mex('src/helloworld.cpp', input)
  
  #2 : unknown filepath / can't find location (interprets entire string as path to mex file)
  input = 'src/helloworld.cpp -outdir C:/Users/ian/mexTesting/mexFiles'
  mex(input)
  
  #3 : same issue as #2
  mex input
  
  #4 : Works, but no variables included, so no easy way to automate
  mex src/helloworld.cpp -outdir /mexFiles
  </code></pre>
  
  <p>All of these (except #4) get either unknown argument -outdir or it interprets the input char arr as a path to a mex file.</p>
  
  <p>Does anyone know how to pass variables into the mex command?</p>
  
  <p>There are no questions that have actually answered this issue that I could find. Any help would be appreciated.</p>