title: Call external function in SPM matlabbatch
body: <p>I tried to use a private MATLAB function (private means that I wrote it myself) via the matlabbatch object in SPM12 that I compiled :</p>
  
  <pre><code>run_spm12.sh $MCR_ENV run batch.m
  </code></pre>
  
  <p>with the batch.m file containing the following lines: </p>
  
  <pre><code>matlabbatch{1}.cfg_basicio.run_ops.call_matlab.inputs{1}.string = 'Hello world';
  matlabbatch{1}.cfg_basicio.run_ops.call_matlab.outputs = {};
  matlabbatch{1}.cfg_basicio.run_ops.call_matlab.fun = 'myfunction';
  </code></pre>
  
  <p>with the function 'myfunction' defined in the file myfunction.m as:</p>
  
  <pre><code>function myfunction(n)
  disp(n);
  end
  </code></pre>
  
  <p>The error message returned by SPM is the following:</p>
  
  <p>Item 'Function to be called', field 'val': Item must be a function handle or function name.</p>
  
  <p>However, it works if i replace the function 'myfunction' by a standard MATLAB function, such as 'disp' for instance. It suggests that, somehow, I need to specify the path to the myfunction.m file but I did not find out how.</p>
  
  <p>Thanks for your help.</p>