Documentation

createLabel

Define金宝appProject label

Syntax

createLabel(category,newLabelName)

Description

example

createLabel(category,newLabelName)creates a new label,newLabelName, in a category. Use this syntax if you previously got acategoryby accessing aCategoriesproperty, e.g., using a command likeproj.Categories(1).

UseaddLabelinstead to create and attach a new label in an existing category using a single step.

UsecreateCategoryfirst 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 calledEngineerswhich can be used to denote file ownership in a project. These labels have the chardatatypefor attaching character vector data.

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

UsefindCategoryto 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.mdl') 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 aCategoriesproperty, e.g. with a command likeproj.Categories(1), or usefindCategory. To create a new category, usecreateCategory.

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

See Also

Functions

Introduced in R2013a

Was this topic helpful?