MATLAB: Can I add additional non-matlab executables to the compiled Matlab application on Linux

MATLAB Compilermcc

FYI, I am using RedHat Linux 6.1 and Matlab 2012a. I have a Matlab function that calls an external executable with a system command among lots of other things. Example:
[s,w] = system('nonMatlabEXE');
I have compiled my Matlab function using:
mcc -m myFunc.m -a /path/to/nonMatlabEXE/* -a /path/to/dataFiles -I /other/required/paths/
This generates the executable 'myFunc', a 'run_myFunc.sh' script, a 'readme.txt', and a mccExludedFiles.log'. However when I run my Matlab compiled exec via Linux command prompt:
run_myFunc.sh /path/to/mcr/
I get "nonMatlabEXE: command not found" errors when I hit that the line with the system command.
So my questions are:
Is it possible to package the non-Matlab executable with my Matlab Compiled app? If not what are my best options? Should I just co-located the non-Matlab executables with the mcc output 'myFunc' and/or modify the shell script 'run_myFunc.sh' to include additional enviroment PATH variables?
Thanks,

Best Answer

You have added the executables to the package. They will get expanded when the stand-alone executable is run. However, the directory they end up in is not necessarily on the execution path methods specified by your operating system. You should build the path to the appropriate location into a string and specify it as part of the system() command. You will likely find ctfroot() useful for building the path.
Please read more about path management for stand-alone executables in this blog post