to add to the original:
uigetpath(''); and '.' all refer back to pwd of compiling machine.
The questions can be rephrased to "how to find current work folder" at runtime?
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!