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!