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

(To be removed) Get a list of labels attached to a file in the currently open Simulink project

    Note:   Simulink.ModelManagement.Project.CurrentProject.getAttachedLabels will be removed in a future release. Instead, use simulinkproject to get a project object, access the Files property of the project, and get the Labels property of a file.


p = Simulink.ModelManagement.Project.CurrentProject()
labels = p.getAttachedLabels(filePath)


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

labels = p.getAttachedLabels(filePath) returns an array of label objects for a file specified using filePath.

Input Arguments


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


To get a list of labels in a file in 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', 'myExample.c');
  3. Use the getAttachedLabels method.

    labels = p.getAttachedLabels(file);
Was this topic helpful?