This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Define Simulink Project label





createLabel(category,newLabelName) creates a new label, newLabelName, in a category. Use this syntax if you previously got a category by accessing a Categories property, e.g., using a command like proj.Categories(1).

Use addLabel instead to create and attach a new label in an existing category using a single step.

Use createCategory first if you want to make a new category of labels.


collapse all

Open the airframe project and create a project object.

proj = simulinkproject;

Examine the first existing category.

cat = proj.Categories(1)
cat = 

  Category with properties:

                Name: 'Classification'
            DataType: 'none'
    LabelDefinitions: [1x8 slproject.LabelDefinition]

Define a new label in the category.


Open the airframe project and create a project object.

proj = simulinkproject;

Create creates a new category of labels called Engineers which can be used to denote file ownership in a project. These labels have the char datatype for attaching character vector data.


Use findCategory to get the new category.

engineersCategory = findCategory(proj,'Engineers');

Create labels in the new category.


Attach one of the new labels to a file in the project.

myfile = findFile(proj,'models/AnalogControl.mdl')
addLabel(myfile,'Engineers', 'Tom');

Get the label and add data.

label = findLabel(myfile,'Engineers','Tom');
label.Data = 'Maintenance responsibility';
Label with properties:

            File: [1x80 char]
            Data: 'Maintenance responsibility'
        DataType: 'char'
            Name: 'Tom'
    CategoryName: 'Engineers'

Input Arguments

collapse all

Category for the new label, specified as a category object. Get the category by accessing a Categories property, e.g. with a command like proj.Categories(1), or use findCategory. To create a new category, use createCategory.

The name of the new label to define, specified as a character vector.

See Also


Introduced in R2013a

Was this topic helpful?