ヘルプ センターヘルプ センター
フォルダーと子ファイルをプロジェクトに追加
addFolderIncludingChildFiles(proj,folder)
newfile = addFolderIncludingChildFiles(proj,folder)
例
addFolderIncludingChildFiles(proj,folder) は、指定されたプロジェクトにフォルダー、すべてのサブフォルダー、およびファイルを追加します。サブフォルダーやファイルを追加せずに、指定されたフォルダーのみを追加するには、代わりに addFile を使用します。
proj
folder
addFile
newfile = addFolderIncludingChildFiles(proj,folder) は、追加されたファイルの ProjectFile オブジェクトを返します。
ProjectFile
すべて折りたたむ
プロジェクト Times Table App を開きます。currentProject を使用して、現在読み込まれているプロジェクトからプロジェクト オブジェクトを作成します。
currentProject
openExample("matlab/TimesTableProjectExample") proj = currentProject;
プロジェクト フォルダーに新規の親フォルダーを作成します。
newFolderPath = fullfile(proj.RootFolder, "newFolder"); mkdir(newFolderPath);
親フォルダーに新規サブフォルダーを作成します。
newSubFolderPath = fullfile(newFolderPath, "newSubFolder"); mkdir(newSubFolderPath);
サブフォルダーに新規ファイルを作成します。
filepath = fullfile(newSubFolderPath, "newVariables.mat"); save(filepath)
親フォルダー、サブフォルダー、ファイルをプロジェクトに追加します。サブフォルダー内のファイルが正しく追加されたことを確認します。
projectFile = addFolderIncludingChildFiles(proj, newFolderPath); findFile(proj,"newFolder/newSubFolder/newVariables.mat")
ans = ProjectFile with properties: Path: "C:\myProjects\examples\TimesTableApp\newFolder\newSubFolder\newVariables.mat" Labels: [1×1 matlab.project.Label] Revision: "" SourceControlStatus: Added
matlab.project.Project
プロジェクト。matlab.project.Project オブジェクトとして指定します。currentProject を使用して、現在読み込まれているプロジェクトからプロジェクト オブジェクトを作成します。
プロジェクトに追加するフォルダーのパス。文字ベクトルまたは string スカラーとして指定します。プロジェクト ルート フォルダーに対して相対的なパスを指定します。指定されたフォルダーはプロジェクト ルート フォルダー内になければなりません。
R2019a で導入
currentProject | openProject | removeFile | addFile
openProject
removeFile
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office