I often have to run some experiments with large data sets in MATLAB. Therefore, it comes handy to do this on a machine that is different from my notebook. The following bash script remotely runs a given MATLAB script called matlabbg and writes all console output to some logfile:
#!/bin/bash
nohup matlab -nodisplay -r "run $1" >$2 2>&1 &
To run the MATLAB script myscript.m in the background and write the output to myscript.log, simply do the following:
matlabbg myscript.m myscript.log