Documentation Center

  • Trial Software
  • Product Updates

addFileToProject

Class: Simulink.ModelManagement.Project.CurrentProject
Package: Simulink.ModelManagement.Project

(To be removed) Add a file to the currently open Simulink project

    Note:   Simulink.ModelManagement.Project.CurrentProject.addFileToProject will be removed in a future release. Use addFile instead.

Syntax

p = Simulink.ModelManagement.Project.CurrentProject()
p.addFileToProject(filePath)

Description

p = Simulink.ModelManagement.Project.CurrentProject() creates an instance of the CurrentProject class.

p.addFileToProject(filePath) adds a file on the specified filePath to the currently open Simulink project.

Input Arguments

filePath

The fully qualified path to the file within the root folder of the project.

Example

To add a file to the currently open Simulink project, use the following commands.

  1. Create an instance of the CurrentProject class.

    p = Simulink.ModelManagement.Project.CurrentProject();
  2. Create a fully qualified path for the file.

      Note:   The use of the getRootDirectory method in this step is optional.

    file = fullfile(p.getRootDirectory, 'work', 'newshortcut.m');
  3. Use the addFileToProject method.

    p.addFileToProject(file);

See Also

Was this topic helpful?