title: Running Matlab script as batch job in linux
body: <p>I'm trying to submit a Matlab script to a Linux server as a batch job but am not having any success so far. I'm very new to Linux so not sure what I'm missing, but I've tried every permutation I can think of.</p>
  
  <pre><code>#!/bin/bash
  #
  #PBS -l walltime=1:00:00
  #PBS -j oe
  #PBS -o testscript.log
  #
  matlab -nodisplay -nojvm -nodesktop -nosplash
  run testscript.m
  </code></pre>
  
  <p>I've also tried these lines with the same header:</p>
  
  <pre><code>export SCRIPT="/panfs/panasas01/phph/testscript.m"
  matlab -nodisplay -nojvm -nodesktop -nosplash
  $SCRIPT
  </code></pre>
  
  <p>And everything in between: with and without the <strong>run</strong> command, <strong>.m, quotes, filepath</strong> etc. The log file shows that Matlab opens but then can't find the command.</p>
  
  <p>I've also tried opening matlab and typing:</p>
  
  <pre><code>batch('testscript')
  </code></pre>
  
  <p>I'm not sure if this command does what I'm looking for, but regardless it results in lots of error messages about not being able to find the variable <code>argsin</code>, along with </p>
  
  <blockquote>
    <p>'Error using batch (line 172) Assignment has more non-singleton rhs
    dimensions than non-singleton subscripts'</p>
  </blockquote>
  
  <p>before the first line (simply a = 10) has even executed. The script runs with no problems otherwise.</p>
  
  <p>Can anyone help?</p>