Submitting Matlab jobs is very similar to submitting MPI jobs or serial jobs (depending if you are using parallela matlab).
The submit file will need to be modified to allow Matlab to work. Specifically, these two lines should be added before calling matlab:
#!/bin/bash
#SBATCH --time=03:15:00
#SBATCH --mem-per-cpu=1024
#SBATCH --job-name=[job_name]
#SBATCH --error=/work/[groupname]/[username]/job.%J.err
#SBATCH --output=/work/[groupname]/[username]/job.%J.out
module load matlab/r2014b
matlab -nodisplay -r "[matlab script name], quit"
The submit file:
#!/bin/bash
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=5
#SBATCH --time=03:15:00
#SBATCH --mem-per-cpu=1024
#SBATCH --job-name=[job_name]
#SBATCH --error=/work/[groupname]/[username]/job.%J.err
#SBATCH --output=/work/[groupname]/[username]/job.%J.out
module load matlab/r2014b
matlab -nodisplay -r "[matlab script name], quit"
In addition to the changes in the submit file, if you are running parallel Matlab, you will also need to add to the .m file the additional lines:
...
i=str2num(getenv('SLURM_TASKS_PER_NODE'));
parpool(i);
...