addFile - Add files or folders to project - MATLAB (original) (raw)
Main Content
Add files or folders to project
Syntax
Description
addFile([proj](#mw%5F6e6ce1a5-689a-413d-a43f-c5f145d7409d),[filesAndFolders](#mw%5F97dae1a4-cc95-448d-a72f-3edfe0c07f29))
adds files and folders to the project proj
. When adding a folder to the project, MATLABĀ® only adds the specified folder. To add the folder including any all subfolders and files, use addFolderIncludingChildFiles instead.
newfiles = addFile([proj](#mw%5F6e6ce1a5-689a-413d-a43f-c5f145d7409d),[filesAndFolders](#mw%5F97dae1a4-cc95-448d-a72f-3edfe0c07f29))
returns an array of ProjectFile
objects for the added files.
Examples
Open the Times Table App project. Use currentProject
to create a project object from the currently loaded project.
openExample("matlab/TimesTableProjectExample") proj = currentProject;
Remove a file.
removeFile(proj,"source/timestable.mlapp")
Add the file back to the project.
addFile(proj,"source/timestable.mlapp");
Add a file to the project and then manipulate the file using the returned project file object.
Open the Times Table App project. Use currentProject
to create a project object from the currently loaded project.
openExample("matlab/TimesTableProjectExample") proj = currentProject;
Save the current workspace variables to a file.
Add the new file to the project and return a project file object.
file = addFile(proj,"myvariables.mat");
Use the project file object to manipulate the file, for example, by adding a label.
addLabel(file,"Classification","Other")
Input Arguments
Path of files and folders to add to the project, specified as a string array or a cell array of character vectors. The specified files or folders must be within the project root. File paths must include the file extension.
Version History
Introduced in R2019a
Starting in R2025a, you can use the addFile
function to add multiple files to the project in one step.