addPath

(Not recommended) Add folder to path of project

simulinkproject is not recommended. Use currentProject or openProject instead. For more information, see Compatibility Considerations.

Syntax

folderpath = addPath(project, folder)

Description

example

folderpath = addPath(project, folder) adds a folder in a project to the current project path. The folder must be in the project. The project puts the folders on the MATLAB® search path when it loads and removes them from the path when it closes. To learn more, see Specify Project Path.

Examples

collapse all

sldemo_slproject_airframe;
project = simulinkproject;

Create a new folder.

 folderpath = fullfile(project.RootFolder,'folder');
 mkdir(filepath);

Add this new folder to the project.

 projectFile = addFile(project,folderpath);

Add this new folder to the project path.

folderpath = addPath(project,folderpath);

Input Arguments

collapse all

Project, specified as a project object. Use simulinkproject to create a project object to manipulate a project at the command line.

Path of the folder to add relative to the project root folder, specified as a character vector or string. The folder must be within the root folder.

Example: models/myfolder

Output Arguments

collapse all

Path folder object containing the specified folder path. The project puts the folders on the MATLAB search path when it loads and removes them from the path when it closes.

Compatibility Considerations

expand all

Not recommended starting in R2019a

Compatibility Considerations

expand all

Not recommended starting in R2019a

Introduced in R2017a