category = findCategory(mainProject,'Engineers');
createLabel(category,'Bob');
Get the label definition object for the new label.
ld = findLabel(category,'Bob')
ld =
LabelDefinition with properties:
Name: "Bob"
CategoryName: "Engineers"
Attach a label to a project file. If you select the file in the Times Table App project, you
can see this label in the Label Editor pane.
myfile = findFile(mainProject,"source/timestable.mlapp");
addLabel(myfile,'Engineers','Bob');
Get a particular label and attach text data to it.
label = findLabel(myfile,'Engineers','Bob');
label.Data = 'Email: [email protected]'
label =
Label with properties:
File: "C:\MATLAB\Projects\examples\TimesTableApp1\source\timestable.mlapp"
DataType: 'char'
Data: 'Email: [email protected]'
Name: "Bob"
CategoryName: "Engineers"
Retrieve the label data and store it in a variable.
mydata = label.Data
mydata =
'Email: [email protected]'
Create a new label category with data type double, the type MATLAB commonly uses for
numeric data.
Create and Edit Projects Programmatically