MATLAB: Prefdir and library path relevance on MRC

librarypathmcrprefdir

I need to modify the librarypath.txt file to run an external program via matlab. I understand that using prefdir in the matlab environment gives the directory to where this is located.
So I am using the following code to add a new folder location (i.e. 'C:/Program Files/Micro-Manager-1.4')
lpfile = fullfile(prefdir, 'librarypath.txt');
[fid, message] = fopen(lpfile, 'at');
if fid < 0;
error('Could not open file because: %s', message);
end
fseek(fid, 0, 'eof');
fprintf(fid, '%s\n', 'C:/Program Files/Micro-Manager-1.4');
fclose(fid)
However, I then complie this so to use on a seperate PC with no matlab but just the MCR. So my question is how the librarypath.txt file work now on the target PC, presuambly the prefdir command isn't relevant to this.
Thnaks for any advice Jason

Best Answer

The machine with only MCR installed will also return a location for "prefdir". For a project named "textMlA", it returned "C:\Users\nidhij\AppData\Local\Temp\nidhij\mcrCache8.5\textMl0\.matlab" on my machine.
When you execute your code on the machine with only MCR, it will refer to the "librarypath.txt" located in a similar folder and make edits to that. If the file does not already exist, it will create the .txt file and make changes to it.