createCategory

Create category of Simulink Project labels

Syntax

  • createCategory(proj,categoryName) example
  • createCategory(proj,categoryName,dataType) example

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.

Examples

expand all

Create a New Category of Labels for File Ownership

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 string 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'

Create a New Category of Labels with Datatype Double

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                 

Input Arguments

expand all

proj — Projectproject object

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

categoryName — Name of categorystring

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

dataType — Class of data to store in labelsstring

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

More About

expand all

Tips

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

See Also

Functions

Was this topic helpful?