Is there anyway to get the folder location where the executable is running ?
조회 수: 21 (최근 30일)
이전 댓글 표시
I want to create an executable which grabs files in the same directory where the executable is running and process it accordingly . I used in the code 'pwd' command to get the current folder location, but when the executable is created Matlab hardcodes the current folder location of my working directory and packages it .Thus i am not able to deploy my tool .
댓글 수: 0
답변 (3개)
Image Analyst
2013년 10월 16일
편집: Image Analyst
2013년 10월 16일
I believe it's in the system variable called ctfroot.
root = ctfroot returns a string that is the name of the folder where the CTF file for the deployed application is expanded.
댓글 수: 2
Image Analyst
2013년 10월 16일
편집: Image Analyst
2013년 10월 16일
cd or pwd is not a reliable and robust way of getting the folder of the executable since the current folder may be changed by code within the executable. Then you might try mfilename('fullpath').
Stefanie Schwarz
2024년 10월 21일
See also:
How can I find the directory containing my compiled application?
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 MATLAB Compiler에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!