current directory on startup
조회 수: 3 (최근 30일)
이전 댓글 표시
If you have a Matlab exe that needs to read a txt file located in the same directory as the exe but you don't have aprori knowledge of the directory name. And when you start the Matlab exe in C:\blah\blah\whatever directory
it looks in win\system32 for the text file.
Is there some generic default $CURRENT you can use in the Matlab code to cd($CURRENT) to force the exe to always look in the directory that it is located in to find the file?
댓글 수: 0
답변 (5개)
Sean de Wolski
2012년 5월 8일
You could always have a startup.m that cd() to the folder you want at startup.
doc startup
doc cd
Not sure is this is what you're looking for.
댓글 수: 0
Jason Ross
2012년 5월 8일
Could use you "matlabroot" to determine the directory of the .exe and then fullfile and cd to get where you wanted to go? There's an example on the matlabroot doc page:
댓글 수: 0
Jason Ross
2012년 5월 8일
If you are using a deployed application, you might also find value in the ctfroot:
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Search Path에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!