Add folders and subfolders to projrct through script

조회 수: 1 (최근 30일)
KUSHAL REDDY
KUSHAL REDDY 2015년 3월 16일
댓글: Andrew Newell 2015년 3월 16일
I want to Add folders and subfolders to project through script. Please five me matlab commands to do so.
  댓글 수: 1
KUSHAL REDDY
KUSHAL REDDY 2015년 3월 16일
편집: Andrew Newell 2015년 3월 16일
Sorry, I want to include it to project (Add to project or ADD subfolders to project) through script.
proj=slproject.getcurrentproject
proj.addfiles(dir)
will only add that dir to project not sub folders. I want command to add subfolders too.

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

답변 (1개)

Andrew Newell
Andrew Newell 2015년 3월 16일
See mkdir.
  댓글 수: 2
KUSHAL REDDY
KUSHAL REDDY 2015년 3월 16일
편집: Andrew Newell 2015년 3월 16일
Sorry, I want to include it to project (Add to project or ADD subfolders to project) through script.
proj=slproject.getcurrentproject
proj.addfiles(dir)
will only add that dir to project not sub folders. I want command to add subfolders too.
Andrew Newell
Andrew Newell 2015년 3월 16일
Sorry, I misunderstood your question. I don't have any experience with projects, but this might work (for the full path name of your folder):
fileTree = genpath(full_path_name);
proj=slproject.getcurrentproject;
filenames = textscan(fileTree,'%s','Delimiter',':');
for ii=1:length(filenames)
proj.addfiles(filenames{ii});
end
The idea is to use genpath and textscan to create a cell array of the names of your folder and subfolders, and then to add them one at a time. However, it may not add the files that are in those folders.

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

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by