Main Content

findCategory

Find project category of labels

Description

categories = findCategory(proj,categoryNames) create category objects for the specified categories in the specified project. You need to get a category before you can use the addLabel or removeLabel function.

example

Examples

collapse all

Open the Times Table App project. Use currentProject to create a project object from the currently loaded project.

openExample("matlab/TimesTableProjectExample")
proj = currentProject;

Use findCategory to get a category of labels by name.

category = findCategory(proj,"Classification")
category = 

  Category with properties:

                Name: "Classification"
        SingleValued: 1
            DataType: "none"
    LabelDefinitions: [1×7 matlab.project.LabelDefinition]

Alternatively, you can get categories by index. Get the first category.

proj.Categories(1)
ans = 

  Category with properties:

                Name: "Classification"
        SingleValued: 1
            DataType: "none"
    LabelDefinitions: [1×7 matlab.project.LabelDefinition]

Find out what you can do with the category.

methods(category)
Methods for class matlab.project.Category:

createLabel  findLabel    removeLabel  

Input Arguments

collapse all

Project, specified as a matlab.project.Project object. Use currentProject to create a project object from the currently loaded project.

Name of the categories to get, specified as a string array or a cell array of character vectors.

Output Arguments

collapse all

Categories of labels, returned as an array of Category objects that you can query or modify. If the specified category is not found, the function returns an empty array.

Version History

Introduced in R2019a

expand all