简体   繁体   中英

Running Matlab script as batch job in linux

I'm trying to submit a Matlab script to a Linux server as a batch job but am not having any success so far. I'm very new to Linux so not sure what I'm missing, but I've tried every permutation I can think of.

#!/bin/bash
#
#PBS -l walltime=1:00:00
#PBS -j oe
#PBS -o testscript.log
#
matlab -nodisplay -nojvm -nodesktop -nosplash
run testscript.m

I've also tried these lines with the same header:

export SCRIPT="/panfs/panasas01/phph/testscript.m"
matlab -nodisplay -nojvm -nodesktop -nosplash
$SCRIPT

And everything in between: with and without the run command, .m, quotes, filepath etc. The log file shows that Matlab opens but then can't find the command.

I've also tried opening matlab and typing:

batch('testscript')

I'm not sure if this command does what I'm looking for, but regardless it results in lots of error messages about not being able to find the variable argsin , along with

'Error using batch (line 172) Assignment has more non-singleton rhs dimensions than non-singleton subscripts'

before the first line (simply a = 10) has even executed. The script runs with no problems otherwise.

Can anyone help?

Answer by @Divakar in comment box:

Try this - matlab -nodisplay -nojvm -nodesktop -nosplash -r testscript

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM