Running an M-File in Batch Mode Without Display
To connect COMSOL with a MATLAB® terminal requires that xterm is installed on the machine. If this is not the case as it might be for a computation COMSOL server, a workaround is to manually connect MATLAB to a COMSOL server with the function mphstart.
These steps describe how to run an M-script that runs a COMSOL model:
1
comsol mphserver -silent &
2
cd COMSOL_path/mli
3
From that location, start MATLAB without display and run the mphstart function in order to connect MATLAB to COMSOL:
matlab -nodesktop -nosplash -r "mphstart; myscript"
For more information about how to connect MATLAB to a COMSOL server, see Starting COMSOL® with MATLAB® on Windows ®/ macOS / Linux®.