Main Content

findCategory

Find project category of labels

Description

example

category = findCategory(proj,categoryName) gets the category from the specified project with the specified name. You need to get a category before you can use the addLabel or removeLabel function.

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 category to get, specified as a character vector or string scalar.

Output Arguments

collapse all

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

Version History

Introduced in R2019a