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 theaddLabelorremoveLabelfunction.

Examples

collapse all

Open the Times Table App project. UsecurrentProjectto create a project object from the currently loaded project.

matlab.project.example.timesTable proj = currentProject;

UsefindCategoryto 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 amatlab.project.Projectobject. UsecurrentProjectto 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 aCategoryobject that you can query or modify. If the specified category is not found, the function returns an empty array.

Version History

Introduced in R2019a