Main Content

removeLabel

Remove label from project

Description

example

removeLabel(category,labelName) removes the specified label from the specified category of labels in the currently loaded project. Use this syntax to remove a label from a category by name.

removeLabel(file,categoryName,labelName) removes the specified label in the specified category from the specified file. Use this syntax to remove a label from a file by name.

removeLabel(file,labelDefinition) removes the label specified by the label definition object labelDefinition. Before you can remove the label, you need to get the label definition object from the file.Label property or by using findLabel.

Examples

collapse all

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

matlab.project.example.timesTable
proj = currentProject;

Examine the first existing category.

cat = proj.Categories(1)
cat = 

  Category with properties:

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

Define a new label in the category.

createLabel(cat,"Future");

Remove the new label.

removeLabel(cat,"Future");

Input Arguments

collapse all

Category of labels, specified as a Category object. Get a Category object from the proj.Categories property or by using findCategory.

Name of the label to remove, specified as a character vector or string scalar.

File to remove the label from, specified as a ProjectFile object. You can get the ProjectFile object by examining the project’s Files property (proj.Files), or use findFile to find a file by name. The file must be within the project root folder.

Name of the category that contains the label to remove, specified as a character vector or string scalar.

Name of the label to remove, specified as a LabelDefinition object returned by the file.Label property or findLabel.

Introduced in R2019a