qsub and Matlab
I am trying to run a Matlab function, file.m, with qsub. Here is a portion of my .sge file:
echo Starting to run Matlab
matlab -nojvm -nodesktop -r "file('${inputfile}');exit;"
echo finished running Matlab
The last two lines of the Matlab function are:
disp('finished');
exit
So my problem is this: The Matlab function runs fine, I haven't checked to see if it saves the .mat file, but the input file is what it should be, and it displays "finished" in the .o output file, and there are no errors. But I think that after it exits Matlab, UNIX doesn't know that it's finished because the "echo finished running Matlab" in the .sge file does not happen. It gets hung up after the "exit;" and stays in the "r" state when I qstat.
Does anyone have an idea of why this happens and how to fix it?
I can tell you that if I type in the "matlab -nojvm ..." line at the command line in my terminal, it runs fine, no errors, and exits Matlab like it should, and saves the .mat file.
What I don't want is to have to write a Matlab script...the codes right now are nice and compact and I have to pass an input file to the function. I could write a new UNIX script and just put the input file loop in the function and run it at the command line without qsub, but I've written this sge script and I'd like to see it work if it can.
Thanks.
|