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 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!