createLabel

(Not recommended) Define project label

simulinkproject is not recommended. Use currentProject or openProject instead. For more information, see Compatibility Considerations.

Description

example

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.

Examples

collapse all

Open the airframe project and create a project object.

sldemo_slproject_airframe
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.

createLabel(cat,'Future');

Open the airframe project and create a project object.

sldemo_slproject_airframe
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.

createCategory(proj,'Engineers','char');

Use findCategory to get the new category.

engineersCategory = findCategory(proj,'Engineers');

Create labels in the new category.

createLabel(engineersCategory,'Tom');
createLabel(engineersCategory,'Dick');
createLabel(engineersCategory,'Harry');

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

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

Get the label and add data.

label = findLabel(myfile,'Engineers','Tom');
label.Data = 'Maintenance responsibility';
disp(label)
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.

Compatibility Considerations

expand all

Not recommended starting in R2019a

See Also

Functions

Introduced in R2013a