Description
According to the following:
- Path Management in Deployed Applications
- For stand-alone exe, how do I include a folder of files and know how to access them.
in order to make sure that your code works both on MATLAB and the standalone app it needs to be written like:
fmt = repmat('%s ',[1,3]);
if ~isdeployed
fileID = fopen('configs.txt');
contents = textscan(fileID,fmt,'CollectOutput',1,'Delimiter',',');
else
fileID = fopen(fullfile(ctfroot,'configs','configs.txt'));
contents = textscan(fileID,fmt,'CollectOutput',1,'Delimiter',',');
end
The code above reads a text file inside the folder 'configs' which is located inside the root folder of the project.
Unfortunately even by following the above guidelines the code still does not work on the standalone version.
The matlab fopen(fullfile(ctfroot,'configs','configs.txt'))
command points to the location: C:\Users\user_name\AppData\Local\Temp\user_name\mcrCache9.0.1\mwm_ml0\configs\configs.txt
where no configs exists.
By navigating inside the folder *C:\Users\user_name\AppData\Local\Temp\user_name\mcrCache9.0.1\mwm_ml0* I noticed that the folder hierarchy of my project (and the folder configs) is actually located inside:
**C:\Users\user_name\AppData\Local\Temp\user_name\mcrCache9.0.1\mwm_ml0\Users\user_name\Documents\MATLAB\Deploy Beta Version**.
I should investigate this further. At the moment if all the files of the project are located inside the same folder and are compiled then the standalone version works like charm.
(refer also to #22)