addAttribute
Add attributes to label or sublabel in label definition creator object for multisignal workflow
Since R2020a
Syntax
Description
addAttribute(
adds an attribute with specified name and type to the indicated label or sublabel. The
attribute is added under the hierarchy for the specified label or sublabel in the ldc
,labelName
,attributeName
,typeOfAttribute
,attributeDefault
)labelDefinitionCreatorMultisignal
object ldc
.
addAttribute(___,
specifies options using one or more name-value pair arguments in addition to the input
arguments in the previous syntax.Name,Value
)
Examples
Add Attributes to Label and Sublabel in Label Definition Creator Object for Multisignal Workflow
Create an empty labelDefinitionCreatorMultisignal
object.
ldc = labelDefinitionCreatorMultisignal;
Add a label with the name 'Car'
. Specify the type of label as 'Rectangle'
. Adding a 'Rectangle'
also adds a 'Cuboid'
entry to the label definitions table.
addLabel(ldc,'Car','Rectangle');
Add an attribute 'Color'
to the label 'Car'
. Specify the attribute type as 'String'
with the value 'Red'
.
addAttribute(ldc,'Car','Color','String','Red')
Add a label with the name 'TrafficLight'
. Specify the type of the label as 'Rectangle'
. Add a description to the label.
addLabel(ldc,'TrafficLight','Rectangle','Description','Bounding boxes for stop signs');
Add a sublabel with the name 'RedLight'
to the label 'TrafficLight'
. Specify the type of the sublabel as 'Rectangle'
.
addSublabel(ldc,'TrafficLight','RedLight','Rectangle');
Add an attribute 'isOn'
to the sublabel 'RedLight'
in the label 'TrafficLight'
. Specify the attribute type for the sublabel as 'logical'
with the value false
.
addAttribute(ldc,'TrafficLight/RedLight','isOn','logical',false);
Display the details of the updated labelDefinitionCreatorMultisignal
object.
ldc
ldc = labelDefinitionCreatorMultisignal contains the following labels: Car with 0 sublabels and 1 attributes and belongs to None group. (info) TrafficLight with 1 sublabels and 0 attributes and belongs to None group. (info) For more details about attributes and sublabels, use the info method.
Display information about the attribute under the label 'Car'
using the object function info
.
info(ldc,'Car')
Name: "Car" SignalType: Image LabelType: Rectangle Group: "None" LabelColor: {''} Attributes: "Color" Sublabels: [] Description: ' ' Name: "Car" SignalType: PointCloud LabelType: Cuboid Group: "None" LabelColor: {''} Attributes: "Color" Sublabels: [] Description: ' '
Display information about the attribute under the label 'TrafficLight'
using the object function info
.
info(ldc,'TrafficLight')
Name: "TrafficLight" SignalType: Image LabelType: Rectangle Group: "None" LabelColor: {''} Attributes: [] Sublabels: "RedLight" Description: 'Bounding boxes for stop signs' Name: "TrafficLight" SignalType: PointCloud LabelType: Cuboid Group: "None" LabelColor: {''} Attributes: [] Sublabels: "RedLight" Description: 'Bounding boxes for stop signs'
Display information about the attribute under the sublabel 'RedLight'
in the label 'TrafficLight'
using the object function info
.
info(ldc,'TrafficLight/RedLight')
Name: "RedLight" Type: Rectangle LabelColor: '' Attributes: "isOn" Sublabels: [] Description: ' '
Display information about the attribute 'isOn'
under the sublabel 'RedLight'
in the label 'TrafficLight'
using the object function info
.
info(ldc,'TrafficLight/RedLight/isOn')
Name: "isOn" Type: Logical DefaultValue: 0 Description: ' '
Input Arguments
ldc
— Label definition creator for multisignal workflow
labelDefinitionCreatorMultisignal
object
Label definition creator for the multisignal workflow, specified as a labelDefinitionCreatorMultisignal
object.
labelName
— Label or sublabel name
character vector | string scalar
Label or sublabel name, specified as a character vector or string scalar that uniquely identifies the label or sublabel to which the attribute is to be added.
To specify a label, use the form 'labelName'.
Example: addAttribute(ldc,'Car','Color')
To specify a sublabel, use the form 'labelName/sublabelName'. In this case, the attribute associates with the sublabel.
Example: addAttribute(ldc,'TrafficLight/RedLight','isOn')
attributeName
— Attribute name
character vector | string scalar
Attribute name, specified as a character vector or string scalar that identifies the attribute to be added to the label or sublabel.
typeOfAttribute
— Type of attribute
attributeType
enumeration | character vector | string scalar
Type of attribute, specified as one of these values:
attributeType
enumeration — The type of the attribute must be one of theseattributeType
enumerators:Numeric
,Logical
,String
, orList
.
Example: addAttribute(ldc,'Car','Color',attributeType.String,'Red');
Character vector or string scalar — This value must partially or fully match one of the enumerators in the
attributeType
enumeration.
Example: addAttribute(ldc,'Car','Color','Str','Red');
attributeDefault
— Default value of attribute
numeric scalar | logical scalar | character vector | string scalar | cell array of character vectors | cell array of string scalars
Default value of the attribute, specified as one of these:
Numeric scalar — Specify this value when
typeOfAttribute
isNumeric
.Logical scalar — Specify this value when
typeOfAttribute
isLogical
.Character vector or string scalar — Specify this value when
typeOfAttribute
isString
.Cell array of character vectors or cell array of string scalars — Specify this value when
typeOfAttribute
isList
. The first entry in the cell array is the default value.
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: addAttribute(ldc,'Car/Wheel','Outsidediameter',attributeType.Numeric,740,'Description','Outside
diameter in mm');
Description
— Attribute description
' '
(default) | character vector | string scalar
Attribute description, specified as a comma-separated pair consisting of
'Description'
and a character vector or string scalar. Use this
name-value pair to describe the attribute.
Version History
Introduced in R2020a
See Also
Objects
Functions
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)