Q – In MATLAB when I try to run a sample code like test.m with the command it shows:
Module load Matlab/R2021a Matlab -nosplash -nodesktop -r “test;quit”
It shows “Killed”.
A – create a text file (e.g. “run.sh”) with lines like so vi or nano. vi run.sh
#!/bin/bash #SBATCH -e slurm.err
#SBATCH --mem-per-cpu=2G # adjust as needed
#SBATCH -c 2 # CPU cores, adjust as needed
module load Matlab/R2021a
matlab -nosplash -nodesktop -r "test;quit"
Submit this with sbatch:
sbatch run.sh