Change Directory (cd)
18 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Ross
il 23 Gen 2012
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 Commenti
Vedere anche
Categorie
Scopri di più su File Operations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!