Rocky MATLAB HelloWorld

From NIMBioS
Revision as of 19:54, 28 April 2023 by Jstratt7 (talk | contribs)

Code

helloworld.m

fprintf("hello world");


Batch Script

helloworld.run

#!/bin/bash

#SBATCH --job-name=MATLAB_HELLOWORLD
#SBATCH --output=logs/matlab_helloworld_%j.out

module load MATLAB/2022b 

matlab -nojvm -batch "run('helloworld.m');"


Running Job

[test_user@rocky7 helloworld]$ pwd
/home/test_user/projects/matlab/helloworld
[test_user@rocky7 helloworld]$ ls
helloworld.m  helloworld.run  logs
[test_user@rocky7 helloworld]$ sbatch helloworld.run 
Submitted batch job 3871
[test_user@rocky7 helloworld]$ ls logs
matlab_helloworld_3871.out
[test_user@rocky7 helloworld]$ cat logs/matlab_helloworld_3871.out 
hello world