Main Content


Add attribute to label in label definition creator for lidar workflow



    addAttribute(ldc,labelName,attributeName,typeOfAttribute,attributeDefault) adds an attribute with the specified name and type to the indicated label. The attribute is added to the hierarchy of the specified label in the labelDefinitionCreatorLidar object ldc.

    addAttribute(___,Name,Value) specifies options using one or more name-value pair arguments in addition to the input arguments in the previous syntax.


    Add Label and Attribute Using Label Definition Creator for Lidar Workflow

    Create an empty labelDefinitionCreatorLidar object.

    ldc = labelDefinitionCreatorLidar
    Add a Cuboid label, Vehicle, to the label definition creator.

    addLabel(ldc, 'Vehicle', 'Cuboid');

    Add a Color attribute to the Vehicle label as a string.


    Display the details of the updated label definition creator object.

    ldc = 
    labelDefinitionCreatorLidar contains the following labels:
    	Vehicle with 1 attributes and belongs to None group.	(info)
    For more details about attributes, use the info method.

    Display information about the label Vehicle using the info object function .

               Name: "Vehicle"
               Type: Cuboid
         LabelColor: {''}
              Group: "None"
         Attributes: "Color"
        Description: ' '

    Display information about the Color attribute of the Vehicle label using the info object function.

                Name: "Color"
                Type: String
        DefaultValue: 'Red'
         Description: ' '

    Input Arguments

    collapse all

    Label definition creator for the lidar workflow, specified as a labelDefinitionCreatorLidar object.

    Label name, specified as a character vector or string scalar. This sets the label to which to add the attribute.

    Attribute name, specified as a character vector or string scalar. This sets the attribute to add to the label.

    Type of attribute, specified using one of these options:

    • attributeType enumeration — Specify the attribute as a Numeric, Logical, String, or List attributeType enumerator. For example, attributeType.String specifies a String attribute type.

    • Character vector or string scalar — Specify a value that partially or fully matches one of the attributeType enumerators. For example, Str specifies a String attribute type.

    Default value of the attribute, specified as a valid attribute value depending on the value of the typeOfAttribute argument:

    • Numeric — Specify the value as a numeric scalar.

    • Logical — Specify the value as a logical scalar.

    • String — Specify the value as a character vector or string scalar.

    • List — Specify the value as a cell array of character vectors or string scalars. The first element of the cell array is the default value.

    Name-Value Pair Arguments

    Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

    Example: 'Description','car' sets the description of the added label attribute to 'car'.

    Attribute description, specified as the comma-separated pair consisting of 'Description' and a character vector or string scalar. Use this name-value pair argument to describe the attribute.

    Introduced in R2020b