필터 지우기
필터 지우기

Creating folders outside of the current folder

조회 수: 103 (최근 30일)
Chinwe Orie
Chinwe Orie 2019년 5월 2일
편집: Stephen23 2021년 12월 21일
Hi!
I would like to use MATLAB to create folders in a specified folder. However, I've only been able to get MATLAB to create folder within the current folder (cd) using the 'mkdir' command. Is it possible for it to create folders outside of the current one if it is told where to create it?
Thank you!

채택된 답변

Stephen23
Stephen23 2019년 5월 2일
편집: Stephen23 2019년 5월 2일
Of course, just define the parentFolder, or use a relative/absolute path:
I also recommend using function syntax:
Putting it all together:
mkdir(ParentFolder,NewSubFolder)
mkdir(fullfile(ParentFolder,NewSubFolder))
  댓글 수: 5
Cory Dinkle
Cory Dinkle 2021년 12월 21일
How could I go about creating a folder outside of the current folder without specifiying the parent folder name?
Stephen23
Stephen23 2021년 12월 21일
편집: Stephen23 2021년 12월 21일
"How could I go about creating a folder outside of the current folder without specifiying the parent folder name?"
Creating a folder requires telling the OS where to create that folder: this may be implicit (e.g. in the current directory) or explicit using a relative/absolute filepath. Perhaps a relative path does what you want.
@Cory Dinkle: please give an example of the path information you have, and the folder that you expect that information to create.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by