Accessing to Parent folder problem
古いコメントを表示
Hello,
I have a problem with my script. I have to create a directory like this in a for cycle:
mkdir(sprintf('c:\%i',j))
How can I create a new directory inside this? I tried :
newfolder = mkdir(sprintf('c:\%i',j))
mkdir newfolder sonfolder
But it doesn't work. Thanks for the help!
回答 (1 件)
Guillaume
2017 年 6 月 2 日
mkdir will create all intermediate directories if necessary, so you can create the whole hierarchy with just one mkdir by passing the full path of your desired sonfolder:
mkdir(fullfile(sprintf('c:\%i', j), sonfolder);
4 件のコメント
Alessandro Cervellera
2017 年 6 月 2 日
Guillaume
2017 年 6 月 2 日
If Funzionali is the name of the folder and not a variable that holds the name, then:
mkdir(fullfile(sprintf('c:\%i', j), 'Funzionali');
or simply
mkdir(sprintf('c:\%i\Funzionali', j));
Alessandro Cervellera
2017 年 6 月 2 日
Walter Roberson
2017 年 6 月 2 日
Guillaume's mkdir(sprintf('c:\%i\Funzionali', j)); should work.
カテゴリ
ヘルプ センター および File Exchange で Search Path についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!