Wednesday, June 20, 2012

Run a Matlab code in the background

Have you wanted to run a Matlab code in the background? Below is the solution I use.

This is the command I use:

matlab -nodisplay < PASCAL_VOC2011_apply_NLPM2_nointerface.m > output_PASCAL_VOC2011_apply_NLPM2.txt &

And inside PASCAL_VOC2011_apply_NLPM2_nointerface.m, I have a call to the main function:

addpathalt
PASCAL_VOC2011_apply_NLPM2

where
addpathalt contains addpath(s) to my toolboxes, and
PASCAL_VOC2011_apply_NLPM2.m is the main function that I want to run.