#!/bin/bash
while read MC M q N
do
    JOB=`qsub -m abe -N rdperm - << EOJ

#!/bin/bash

#PBS -j oe
#PBS -l cput=30:00:00
#PBS -l mem=8gb

cd ~/matlabprog
matlab > "rdperm_sim_${MC}_${M}_${q}_${N}.log" << M_PROG
rdperm_sim(${MC},${M},${q},${N});
M_PROG
EOJ
`

echo "JobID = ${JOB} for parameters ${MC} ${M} ${q} ${N} submitted on `date`"
done < rdperm_par.txt
exit