Documentation

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.

createCategory

Create category of Simulink Project labels

Syntax

createCategory(proj,categoryName)
createCategory(proj,categoryName,dataType)
createCategory(proj,categoryName,dataType, single-valued)

Description

example

createCategory(proj,categoryName) creates a new category of labels categoryName in the project proj.

example

createCategory(proj,categoryName,dataType) specifies the class of data to store in labels of the new category.

example

createCategory(proj,categoryName,dataType, single-valued) specifies a single-valued category, where you can attach only one label from the category to a file. If you do not specify single-valued, then you can attach multiple labels from the category to a file.

Examples

collapse all

Create a new category of labels for file ownership, and attach a new label and label data to a file.

Open the airframe project and create a project object.

sldemo_slproject_airframe
proj = simulinkproject;

Create a new category of labels, called Engineers, 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.mdl')
addLabel(myfile,'Engineers','Tom');

Get the label and add data.

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

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

Open the airframe project and create a project object.

sldemo_slproject_airframe
proj = simulinkproject;

Create a new category of labels.

createCategory(proj,'Coverage','double')
category = 

  Category with properties:

                Name: 'Coverage'
            DataType: 'double'
    LabelDefinitions: []

Find out what you can do with the new category.

category = findCategory(proj, 'Coverage');
methods(category)
Methods for class slproject.Category:

findLabel  removeLabel  createLabel                 

Open the airframe project and create a project object.

sldemo_slproject_airframe
proj = simulinkproject;

Create a category of labels for file ownership, and specify single-valued to restrict only one label in the category per file.

createCategory(proj,'Engineers','char', 'single-valued');

Input Arguments

collapse all

Project, specified as a project object. Use simulinkproject to create a project object to manipulate a Simulink® Project at the command line.

Name of the category of labels to create, specified as a character vector.

The class of data to store in labels in the new category, specified as a character vector.

Single-valued category, specified as a character vector. Single-valued means you can attach only one label from the category to a file. If you do not specify single-valued, then you can attach multiple labels from the category to a file.

Tips

After you create a new category, you can create labels in the new category. See createLabel.

See Also

Functions

Introduced in R2013a

Was this topic helpful?