Here is an example of how to run MATLAB in batch mode from your UNIX prompt:
Bourne shell example: (file called atfile.sh )
TERM=; export TERM
matlab > inline.out << EOF
a = [1 2]
quit
EOF
Sample at command on Sun: (-s says use the Bourne shell)
% at -s now + 1 min atfile.sh
C shell example: (file called atfile.csh )
setenv TERM
matlab >! inline.out << EOF
a = [1 2]
quit
EOF
Sample at command on Sun:
% setenv SHELL '/bin/csh -f'
% at now + 1 min atfile.csh
% setenv SHELL /bin/csh
In summary,
Define TERM in the script before you call MATLAB and make it part of the environment. Be sure that the right shell is used to execute the script. If your script is a C shell, you must do the SHELL change in order not to get any extra mail messages from the job. remember that -f means that your .cshrc file will not be executed before you run the script. So, you cannot use any of the parameters set in the script.