MATLAB: Standalone exe: how to change uigetdir to avoid the dependency of the path

alternativeexepathstandaloneuigetdir

Hallo there,
I'm currently trying to built a standalone exe from my Matlab programm. Unfortunately I am using the path to different files/folders in my Matlab code and I know that this is not possible for a standalone exe. Is there an easy way to change this?
Thank you for your help!

Best Answer

One thing to remember is that if you load() or imread() a file using a pathname that is not an absolute pathname, then in a standalone executable, the first place that it is going to check for the file is ctfroot(), and it will check there before looking at the MATLAB path. Therefore if you have read-only files and folders you can add them to the project and use them as-if they are in your current directory. If you need to write temporary files use tempdir() and tempname(); if you need to write permanent files then you start running into difficulty.