MATLAB: Problem in external file while deploying GUI into a standalone application

compilerexcelguipathstandalone

I have programmed a GUI that needs different excel files to work. When using the MATLAB Compiler to make it a standalone application, the executable doesn't work. I believe this may be caused by the excel files and their poor routing. I've been told the best way to solve this is using CTFROOT or relative paths but i'm new in that area. Can someone clarify this? The excel files are saved in the same folder as the GUI files. Thanks in advance.

Best Answer

Best practice is to use fullfile() with ctfroot to construct the filename, and winopen() that
filename = fullfile(ctfroot(), 'TrainedData\Romulus\physcons.xlsx');
winopen(filename);