0

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.

Nigel Davies
  • 1,640
  • 1
  • 13
  • 26
Hanan Kavitz
  • 1
  • 1
  • 2

1 Answers1

0

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
Nigel Davies
  • 1,640
  • 1
  • 13
  • 26