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

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

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


p = Simulink.ModelManagement.Project.CurrentProject()


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

p.attachLabelToFile(filePath,labelObj) adds a label to a file specified using filePath using the label object labelObj .

Input Arguments


The fully qualified path to the file to which the label is to be attached.


The label object used to attach the label to the file.


To attach a label to a file in the currently open Simulink project with a review status Approved, 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. Create a label object.

    labelObj = Simulink.ModelManagement.Project.Label('Review','Approved');
  4. Use the attachLabelToFile method.

Was this topic helpful?