Contenido principal

removeFile

R2026b

Remove file or folder from project

Description

Note

Starting in R2026b, you can create or convert a project to use the single TOML project definition file (matlab.toml). In TOML‑based projects, the project definition does not manage file membership, so you do not need removeFile to remove files from the project. However, removeFile still removes files from source control.

removeFile(proj,filesAndFolders) removes files and folders from the specified project.

example

Examples

collapse all

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/timesTableGame.m")

Add the file back to the project.

addFile(proj,"source/timesTableGame.m")

Input Arguments

collapse all

Project, specified as a matlab.project.Project object. Use currentProject to create a project object from the currently loaded project.

Files or folders to remove, specified as a string array, a cell array of character vectors, or an array of ProjectFile objects.

Version History

Introduced in R2019a

expand all