Documentation Center

  • Trial Software
  • Product Updates

getLabels

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

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

    Note:   Simulink.ModelManagement.Project.CurrentProject.getLabels will be removed in a future release. Instead, use simulinkproject and then access the Labels property of project files, or use findLabel to get labels by name.

Syntax

p = Simulink.ModelManagement.Project.CurrentProject()
labels = p.getLabels(category)

Description

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

labels = p.getLabels(category) returns an array of label names in a specified category in the currently open Simulink project.

Input Arguments

category

The name of a category in the currently open Simulink project.

Examples

  • To get a list of labels in category Review in 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 getLabels method.

      labels = p.getLabels('Review');
    3. To view the cell array containing the category names, use

      labels{:}
  • To display all the labels within the currently open Simulink project, run the following code.

    p = Simulink.ModelManagement.Project.CurrentProject();
    categories = p.getCategories;
    for jj = 1:numel(categories)
        thisCategory = categories{jj};
        disp([thisCategory ' : ']);
        labels = p.getLabels(thisCategory);    
        for kk = 1:numel(labels)
            thisLabel = labels(kk);
            disp([' - ' thisLabel.Name]);
        end
    end
    

See Also

Was this topic helpful?