Add folder to project path
adds a folder to the specified project path. The folder must be in the project. The
project puts the folder on the MATLAB® search path when it loads, and removes it from the path when it
closes. To learn more, see Specify Project Path.
folderonpath = addPath(
Add Folder to Project Path
Open the Times Table App project. Use
to create a project object from the currently loaded project.
matlab.project.example.timesTable proj = currentProject;
Create a new folder.
newfolder = fullfile(proj.RootFolder,"newfolder"); mkdir(newfolder);
Add the new folder to the project.
Then, add the new folder to the project path.
newfolderonpath = addPath(proj,newfolder);
proj — Project
Project, specified as a
currentProject to create a project object from the currently
folder — Path of folder
character vector | string
Path of the folder to add to the project path, specified as a character vector or string. Specify the path relative to the project root folder. The folder must be within the root folder.
folderonpath — Folder on project path
Folder on project path, returned as a
containing the added folder path. The project puts the folders on the
MATLAB search path when it loads and removes them from the path when
Introduced in R2019a