title: Matlab publish - Want to use a custom file name to publish several pdf files
body: <p>I have several data log files (here: 34) for those I have to calculate some certain values. I wrote a seperate function to publish the results of the calculation in a pdf file. But I only can publish one file after another, so it takes a while to publish all 34 files. </p>
  
  <p>Now I want to automize that with a loop - importing the data, calculate the values and publish the results for every log file in a new pdf file. I want 34 pdf files for every log file at the end.</p>
  
  <p><strong>My problem is, that I couldn't find a way to rename the pdf files during publishing. The pdf file is always named after the script which is calculating the values. Obviously the pdf is overwritten within a loop. So at the end everything is calculated, but I only have the pdf from the last calculated log file.</strong></p>
  
  <hr>
  
  <p>There was this hacky solution to change the Matlab publish script, but since I don't have admin rights I can't use that:</p>
  
  <p><em>"This is really hacky, but I would modify publish to accept a new option prefix. Replace line 93</em></p>
  
  <pre><code>[scriptDir,prefix] = fileparts(fullPathToScript);
  </code></pre>
  
  <p><em>with</em></p>
  
  <pre><code>if ~isfield(options, 'prefix')
      [scriptDir,prefix] = fileparts(fullPathToScript); 
  else
      [scriptDir,~] = fileparts(fullPathToScript);
      prefix = options.prefix; end
  </code></pre>
  
  <p><em>Now you can set options.prefix to whatever filename you want. If you want to be really hardcore, make the appropriate modifications to supplyDefaultOptions and checkOptionFields as well."</em></p>
  
  <p>Any suggestions?</p>
  
  <p>Thanks in advance,
  Martin</p>