Matlab
IMPORTANT:The following instructions are only for people who are not able to use the Matlab Compiler, mcc. Using mcc preservesmatlab licenses and allows you to run many more copies of your Matlab code. Please makeevery effort to use mcc. If we see you using Matlab, we may ask you aboutyour experiences with mcc, so if you have trouble, please let us know.
Matlab in Serial
To access Matlab on the clusters, you must first type module load matlab.
A sample PBS script that shows a 1-CPU Matlab job looks like this:
#PBS -N matlab1
#PBS -q route
#PBS -l nodes=1,mem=1gb,walltime=24:00:00
#PBS -l gres=matlab
#PBS -M your-email-address
#PBS -m abe
#PBS -V
#
echo "I ran on:"
cat $PBS_NODEFILE
#
#cd to your execution directory first
cd /home/your-user-name/your-matlab-directory
#Run the input file.m
matlab -r file
#
Plotting in Batch Sample
y=1:100;
plot(y,y)
print -depsc yvsy
%save the plot as yvsy.eps (postscript color)
%run: 'help print' for options (-djpeg -dpng etc)
exit
%matlab must exit in all batch jobs when finished
Notethat your Matlab job will not have any access to a graphical display orterminal, so all of your input must be handled by one .m file (which can call other .m files) and all of your output must be written to either a file or the screen (standard out) by Matlab or saved with the printcommand. It is slightly faster to write your output to the screen(standard out) and let PBS deliver the results to you at the end. Ifyou send your output to the screen, you can monitor it while it isrunning using the qpeek command; type qpeek --help for more information.
To use the Symbolics Toolkit you need to use the 32-bit version of matlab; start your session with the option -glnx86.
Matlab in parallel using the Distributed Computing Toolkit
Please see our dedicated page: Matlab DCT


