addFile

(Not recommended) Add file to project

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

Syntax

addFile(proj,fileorfolder)

Description

example

addFile(proj,fileorfolder) adds a file to the project proj.

Examples

collapse all

Open the airframe project and create a project object.

sldemo_slproject_airframe
proj = simulinkproject;

Remove a file.

removeFile(proj,'models/AnalogControl.mdl')

Add the file back to the project.

addFile(proj,'models/AnalogControl.mdl');

Create and save a new model.

new_system('mymodel');
save_system('mymodel');

Add the new file to the project and return a project file object.

newPrjFile = addFile(proj,'mymodel.slx');

Use the project file object to manipulate the file, for example, adding a label.

addLabel(newPrjFile, 'Classification', 'Design')

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 file or folder to add relative to the project root folder, specified as a character vector, string, or array. Files must include the file extension. The file or folder must be within the root folder.

Example: ‘models/myModelName.slx’

Compatibility Considerations

expand all

Not recommended starting in R2019a

Introduced in R2013a