Tom
Tom

Reputation: 934

Linux cluster shell for parallel matlab simulation

I need to call a matlab function with different input arguments in Linux shell, I wrote my loop in the following form and it works:

set c=1 

while ( $c <= 5 ) 

#JOB='qsub -m abe -N Big_run - << EOJ matlab -nodisplay -nodesktop << M_PROG test ($c); M_PROG EOJ` 

@ c = $c + 1 

end

There are 2 problems, one is " mismatched `. "

The other one is how to pass input argument to matlab function?

Upvotes: 0

Views: 92

Answers (1)

Andrew Cheong
Andrew Cheong

Reputation: 30273

For your first problem, just use a matching apostrophe ' instead of the grave tick `:

#JOB='qsub -m abe -N Big_run - << EOJ matlab -nodisplay -nodesktop << M_PROG test ($c); M_PROG EOJ'

For your second problem, run it like this...

matlab -nodisplay -nodesktop -r "yourFunction(42)"

...where 42 is your input argument.

More information here: Unix commandline start: passing arguments to m file. A good example from near the end:

matlab -nosplash -nodisplay -nojvm -nodesktop -r "input('A'),input('B'),input('C','s')"

Upvotes: 1

Related Questions