This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

addReference

(Not recommended) Add referenced project to project

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

Syntax

projreference = addReference(project,folder)
projreference = addReference(project,folder,type)

Description

example

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

example

projreference = addReference(project,folder,type) specifies the type of reference to create. Specify relative or absolute reference.

Examples

collapse all

Create a project and get a project object.

sldemo_slproject_airframe;
project = simulinkproject;

Create a new blank project.

projectToReference = slproject.create();

Reload the first project and add a reference to the new blank project.

reload(project);
addReference(project, projectToReference, 'absolute');

Find out if a project is a top-level project. 1 indicates a top-level project.

project.Information.TopLevel
ans =

  logical

   1

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 the reference, relative to the project root folder, specified as a character vector. The folder must be within the root folder.

Example: models/myfolder

Type of reference, relative to the project root folder, specified as a character vector.

Output Arguments

collapse all

Project reference object containing information about the referenced project.

Compatibility Considerations

expand all

Not recommended starting in R2019a

Introduced in R2017a