I have a MATLAB compiler generated binary (exe/jar/dll).
I would like to be able to get the full path of the binary itself at runtime.
Any ideas? Help will be very appreciated.
I have a MATLAB compiler generated binary (exe/jar/dll).
I would like to be able to get the full path of the binary itself at runtime.
Any ideas? Help will be very appreciated.
This seems to be a tricky topic in deployed MATLAB. Internet searching will find complicated answers in MATLAB Central.
However, this might help.
[p,f,i] = uigetfile('')
It is a bit of a hack, but will find the directory containing the .exe, which is returned in p.
When I went back to get a link to the answer in MATLAB Central, I found this which also answers your question:
function currentDir = getcurrentdir
if isdeployed % Stand-alone mode.
[status, result] = system('path');
currentDir = char(regexpi(result, 'Path=(.*?);', 'tokens', 'once'));
else % MATLAB mode.
currentDir = pwd;
end