주요 콘텐츠

addReference

Add referenced project to project

Description

projreference = addReference(proj,reference) adds a reference to the project specified by reference. The reference is added to the specified project, proj.

example

projreference = addReference(proj,reference,type) specifies the type of reference to create. Specify the type as either "relative" or "absolute".

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;

Create a blank project.

projectToReference = matlab.project.createProject();

Reload the first project and add a reference to the new blank project. Reloading the first project is necessary because since only one project can be open at one time, MATLAB® unloads the first project before creating and opening the new blank project.

reload(proj);
addReference(proj,projectToReference,"absolute");

Input Arguments

collapse all

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

Reference to the project you want to add, specified as a matlab.project.Project object or as a character vector or string scalar. If you specify this argument as a character vector or string scalar, specify an absolute path or a path relative to the project.

Type of reference, specified as "relative" or "absolute". Specify "relative" if your project hierarchy has a well-defined root relative to your project root, for example, a folder under source control. Specify "absolute" if the project you want to reference is in a location accessible to your computer, for example, a network drive.

Output Arguments

collapse all

Referenced project, returned as a ProjectReference object containing information about the referenced project.

Version History

Introduced in R2019a