0

I'm using pwd function to generate current path in app designer of MATLAB R2016a but this function finds MATLAB current folder (main window of MATLAB) not app designer current folder. What should I do?

Suever
  • 64,497
  • 14
  • 82
  • 101
Eghbal
  • 3,892
  • 13
  • 51
  • 112
  • 1
    I don't understand what you're asking. MATLAB doesn't have multiple current directories. – sco1 Aug 17 '16 at 08:24
  • @excaza. When we use `pwd` in app designer, this function finds MATLAB current folder in main window not the path that the designed app is running there (we don't have this problem in `GUIDE`). When we run an app in `GUIDE`, this app changes the current folder of MATLAB to `GUIDE` app, so `pwd` function finds the app path (same as current folder of MATLAB in this situation). – Eghbal Aug 17 '16 at 08:26
  • 1
    Possible duplicate of [Find location of current m-file in MATLAB](http://stackoverflow.com/questions/2720140/find-location-of-current-m-file-in-matlab) – sco1 Aug 17 '16 at 12:25
  • @excaza. Thank you. Please add your answer. + we need to remove file name in the end of path. – Eghbal Aug 18 '16 at 10:37

1 Answers1

2

I was also looking for the answer of your question. In the comments of your question the hardest part of the problem was given by "excaza". But I eventually used:

[directory,~,~] = fileparts(mfilename('fullpath'));

Good luck

Buskebam
  • 21
  • 3