#!/bin/bash # # Script Name : msub # Purpose : to submit matlab batch job with command line input # This script generates a temp script file called "msub.userid" # It is then used as the batch script for use with qsub # to perform matlab work in batch # msub takes two or three command line inputs : # 1) m-file with suffix .m # 2) an outputfile name to which matlab output goes # 3) Optionally, anything you would like to pass on to qsub # (make sure to enclose them with double quotes) # Example: # cootie % msub example.m outputfile "-l walltime=00:15:00" # # Author : Kadin Tseng, SCV, Boston University # Date : August 30, 2004 if [ $# -ge 2 ] then script="msub.${USER}" echo "#!/bin/bash" > $script echo "cd \$PBS_O_WORKDIR" >> $script echo "matlab -nodisplay < $1 > $2" >> $script echo "exit 0" >> $script chmod +x $script qsub $script $3 else echo 'Usage: msub example.m outputfile ["optional qsub params"]' fi