Change Directory (cd)
조회 수: 17 (최근 30일)
이전 댓글 표시
Hi, I need to change the current directory of Matlab in a m file. I want to know if its possible to use a variable to change the directory
Here's my problem:
I have a variable containing a name of folder. (var = Nameoffolder). Then, I run a .exe in matlab and it writes results in some .txt files in a folder with the same name that my variable After, I want Matlab to post-process my data. So I want change the current directory to ..\Nameoffolder
How can I do this ?
Thx for the help !!
댓글 수: 0
답변 (1개)
Ross
2012년 1월 23일
I'm interpreting your question as: I have a variable of class 'char', ie a variable that defines the directory you want to change to. cd can be called two ways. The first requires the actual text, ie
cd ~/myfilepath
However, you can also use:
filepathString = '~/myfilepath';
cd(filepathString);
Does that answer your question?
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 File Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!