MATLAB Report Generator | ![]() ![]() |
Creating Another Attribute
Create another attribute called AxesColor
, which lets the user choose one of four colors for the axes: white, green, red and blue. The default color will be white. The name of the attribute, as is appears in the Setup File Editor, will be Color of Axes
.
To do this task, add the following lines of code to getinfo.m
(comments are preceded by `%'
and are optional).
% This creates an attribute called AxesColor, which has a default
% color of white (1 1 1).
out.att.AxesColor=[1 1 1]
; % This creates a name for the attribute, which appears in the % attribute page in the Options tab.out.attx.AxesColor.String='Color of axes';
% This creates an enumerated list with color choices of % white (1 1 1), green (0 1 0), red (1 0 0), and blue (0 0 1). out.attx.AxesColor.enumValues = {[1 1 1] [0 1 0] [1 0 0] [0 0 1]}; % This creates the names for the entries in the enumerated % list: white, green, red and blue.) out.attx.AxesColor.enumNames = {'white' 'green' 'red' 'blue'};
Note that out.attx.AxesColor.UIcontrol and out.attx.AxesColor.Type are not specified here. A default UI control and data type are used, according to the default value.
Changing a Previously Created Attribute
You can change a field for any attribute that you create by editing the getinfo.m
.
The slider created for NumLines
has a range of -inf
to inf
.
A slider by default has a range of: [-inf +inf]
; it guesses about the range. Change the slider range to [1 10]
(minimum and maximum number of lines).
![]() | Creating a New Attribute | Changing the Outline String | ![]() |