Matlab ============ Method 1: Running a ``.m`` file --------------------------------- .. code-block:: bash #!/bin/bash #$ -cwd #$ -l h_rt=8:00:00,h_data=4g #$ -o stdout.$JOB_ID #$ -e stderr.$JOB_ID .... # Use system-wise modules source /u/local/Modules/default/init/modules.sh module load matlab/2020a # Run program fname_in=“/path/of/your/matlab/script.m" matlab -nodisplay -nodesktop -nosplash -r "run(‘$fname_in’); exit” Method 2: Compile & Run -------------------------- It is possible to compile the matlab code into an executable, then run the executable, in a two-step process: 1. Compile the matlab code using the Matlab compiler, ``mcc`` 2. Submit the executable just like any other executable Step 1. Compile the .m file .. code-block:: bash # from the login node qrsh -l h_rt=1:00:00,h_data=8g ... # on the compute node module load matlab/2020a # generate executable file $ mcc -m -R -nodisplay,-singleCompThread test -o test_exe $ chmod a+x test_exe The compiling step will also generate a shell script file, ``run_test_exe.sh``, that will run the compiled executable. Step 2. Submit the shell script (``run_test_exe.sh``) .. code-block:: bash #!/bin/bash #$ -cwd #$ -l h_rt=8:00:00,h_data=4g #$ -o stdout.$JOB_ID #$ -e stderr.$JOB_ID .... source /u/local/Modules/default/init/modules.sh module load matlab/2020a # Run program ./run_test_exe.sh $MATLAB_DIR