Documentation Center

  • Trial Software
  • Product Updates

getRootFolder

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

(To be removed) Get the name of the root folder for the currently open Simulink project

    Note:   Simulink.ModelManagement.Project.CurrentProject.getRootFolder will be removed in a future release. Access the RootFolder property of a project object instead. Use simulinkproject to get a project object.

Syntax

p = Simulink.ModelManagement.Project.CurrentProject()
p.getRootFolder

Description

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

p.getRootFolder returns the name of the root folder for the currently open Simulink® project.

This method is particularly useful when creating start up and shutdown scripts, or functions, for a project. Use this method to determine the project root folder so that sub-folders of the project can be added to the MATLAB® path without using absolute paths.

Example

To get the name of the root folder for the currently open Simulink project, use the following commands.

  1. Create an instance of the CurrentProject class.

    p = Simulink.ModelManagement.Project.CurrentProject();
  2. Use the getRootFolder method.

    p.getRootFolder;

See Also

Was this topic helpful?