I'm writing my approach to the problem that will may help you.
First I tried to run stamps_mc_header (from the directory where the PATCH_X directories are).
Even though it displayed the messages every 20secs it failed to start the matlab commands but it had normally created the patch_list_split_<nthcpu> files and copied the parms.mat file to each PATCH_X directory.
I tried to run the matlab commands formed by the original script from a terminal but they did not work.
I then tried to run the stamps function from within matlab with the parallelisation option like this:
stamps(<start_step>, <end_step>, , 0, 'patch_list_split_<nthcpu>', 1 )
It run successfully.
After some tries I manage to form the following shell command that run successfully on my system.
nohup matlab -nodesktop -nodisplay -r "addpath('your_stamps_mat_dir'); stamps(<start_step>, <end_step>, , 0, 'patch_list_split_<nthcpu>', 1 ); exit" > log_stamps_split_<nthcpu>
The change is that I start with nohup (avoiding unexpected termination) and I add the matlab path of Stamps that is lost from matlab when started this way.
I believe that this way the command should successfully run on a wider range of system configuration.
This is the command that is formed by the script I posted. It also assumes that the system variable to StaMPS folder is STAMPS (line 156)
(Of course it needs to find the patch_list_split_<nthcpu> files and the parms.mat to each PATCH_X directory)
You may also uncomment the fprintf at line 163 of the posted script to see the command formed and try it directly from terminal or only the stamps function from matlab.
Be sure to run from the directory where the PATCH_X directories are.
The command formed by the original script stamps_mc_header is like this:
matlab -nodesktop -nodisplay -r "stamps(<start_step>, <end_step>, , 0, 'patch_list_split_<nthcpu>', 1 ); exit" > log_stamps_split_<ncpu>