queue
 {endcode}
 
+{section: Compiled Matlab Example (completely tested)}
+
+Given a successful mcc run, as described above, and assuming the matlab runtime isn't pre-install on any of the execute machines, you can transfer the runtime along with the condor job.  There is an example of this in chtc in /home/gthain/CompiledMatlabExample.  First, put the whole runtime into a single tar file, called m.tgz.  Then, edit the run_foo.sh wrapper (which was created by the compiler) to add the lines
+
+{code}
+tar xzf m.tgz
+mkdir cache
+chmod 0777 cache
+export MCR_CACHE_ROOT=`pwd`/cache
+
+{endcode}
+at the beginning of the script, but after the #! line.  When matlab runs, it wants to create a cache directory under the user's home directory, which may not exist on an execute machine, or may conflict with other concurrently running matlab.  Then, create a submit file that looks something like:
+
+{code}
+universe = vanilla
+
+executable = run_foo.sh
+arguments = ./mathworks-R2009bSP1
+
+should_transfer_files = yes
+when_to_transfer_output = on_exit
+transfer_input_files = m.tgz, foo
+
+output = out
+error  = err
+log    = log
+queue
+
+{endcode}