MATLAB: How to use the SYSTEM function, on a Solaris platform to run a batch job without MATLAB creating a pseudo-tty and freezing the machine

MATLABtty

I start a batch job using:
% cat commands.m
system ('gzip testfile')
% qsub
touch testfile
touch testfile.gz
matlab -nodisplay < commands.m
^D
your job 443354 ("STDIN") has been submitted
The MATLAB job makes a system call to gzip to compress "testfile". Because a file already exists with the same name as the compressed file ("testfile.gz"), gzip does one of two things:
1. With an interactive session (i.e., a pseudo-tty) attached to the process, the system asks the user if they wish to overwrite the file.
2. During a non-interactive session (i.e., the process has no attached pseudo-tty), gzip aborts without overwriting.

Best Answer

You cannot run the SYSTEM function to handle 'gzip' files in MATLAB.
To work around this issue, replace:
system('gzip testfile');
with:
system('gzip testfile < /dev/null')