MATLAB Report Generator | ![]() ![]() |
Creating a New Attribute
You can create a new attribute by editing getinfo.m
. This methods file contains information on component attributes and how they are displayed in the component attribute page (shown in the Options tab of the Setup File Editor).
All attribute information for a component is taken from out.att.XXX
and out.attx.XXX
lines in getinfo.m
. The out.att.XXX
lines are attributes and the out.attx.XXX
lines are UI options. The out.attx.XXX
lines are optional; they do not need to be included in getinfo.m
. If you do not include them, default UI controls are used for the attribute.
Finding Attributes and Their Default Values
Find the following section in getinfo.m
.
%---------------------- ATTRIBUTES --------------------
%The out.att.XXX section sets attribute defaults.
out.att.Plot_Title = 'My Random Plot';
out.att.NumLines = [3];
This section shows that there are two attributes.
Adding a New Attribute and Default Value
Create another attribute called isVisibleAxes
. This attribute determines whether the figure axes are visible. The attribute will have a default value of logical 1 (axes on).
To complete this task, add the following line to this section.
Specifying Attribute Name, Data Type and UI Control
To specify attribute name, data type, and UI Control, (corresponds to Att. name, Data type, and Control type fields in the Component Attributes page), find the following section in getinfo.m
.
%------------------ ATTRIBUTE DISPLAY ----------------- %The out.attx.XXX section sets attribute GUI information. %Each .attx structure has the following fields: % .String - Appears as a text field next to the UIcontrol % .Type - data type of the corresponding attribute. % STRING - character string % NUMBER - scalar or vector number % LOGICAL - boolean logical(1)/logical(0) % ENUM - enumerated list of STRING, NUMBER, or LOGICAL % CELL - cell array % OTHER - structure or object % note: "OTHER" has no automated uicontrol updating % .enumValues - options for an enumerated list (.Type='ENUM') % .enumNames - display representation of .enumValues % note: must be same length as .enumValues % note: empty enumNames implies display from enumValues % .UIcontrol - type of control to use in GUI % .numberRange - min and max values (.Type-'NUMBER') out.attx.Plot_Title.String='Title of created plot'; out.attx.Plot_Title.Type='STRING'; out.attx.Plot_Title.UIcontrol='edit'; out.attx.NumLines.String='Number of lines to appear in plot'; out.attx.NumLines.Type='NUMBER'; out.attx.NumLines.UIcontrol='slider'; out.attx.NumLines.numberRange=[inf inf];
Attribute Name. out.attx.isVisibleAxes.String
is the name of the attribute as it appears in the Setup File Editor (corresponding to the Att. name field of the Component Attributes page in the Component Creation Wizard).
To create the attribute name for isVisibleAxes
called 'Make figure axes visible'
, add the following line to this section.
Attribute Data Type. out.attx.isVisibleAxes.Type
is the data type of the attribute (corresponds to the Data type field of the Component Attributes page in the Component Creation Wizard).
To specify the data type for isVisibleAxes
to be logical, add the following line to this section.
LOGICAL
sets the data type to be a logical or Boolean number.
Note If you do not set the type, the Report Generator will infer the type from the default value you supplied earlier. |
Attribute UI Control. out.attx.isVisibleAxes.UIcontrol
is the type of UI control for the attribute (corresponding to the Control type option of the Component Attributes page in the Component Creation Wizard).
To specify the UI control for isVisibleAxes
to be a check box, add the following line to this section.
![]() | Using the New Component | Creating Another Attribute | ![]() |