MATLAB Report Generator | ![]() ![]() |
Creating the Component Name
When you create a component, you have to decide:
You enter this information on the Component Name page of the Component Creation Wizard.
Click on Component Name in the list box on the left to get to the Component Name page. Or, if you have just completed the Component Category page, click on the Next -> button.
Naming the Component
You need to specify a name for the component you are creating. The name you choose will appear in the Add Component tab of the Setup File Editor.
Tutorial Task
Specifying the Component Function Name
By convention, the component function name should have the format cxx_<function name>
. The first letter of the component function name should always be c
. The second and third letters are from the two-letter code that you entered in the New category ID field in the Component category page. In this case, the letters are rp
.
The function name should be simple, but descriptive. The function name should be made up of valid characters (for a MATLAB function); for example, the function name should not contain an ampersand (&). Any invalid characters are changed to an underscore (_
).
After you create the new component, you can get an instance of the object or component by typing the component function name at the command line.
Tutorial Task
In the Component Function Name field, enter
Specifying the Parent Directory
When you create the component, methods or M-files are created for the component. These M-files are located in a directory called @cxx_<FunctionName>
, which is located in the directory that you specify in the Parent directory field.
You should choose a parent directory that is on the MATLAB path. Otherwise, it may be difficult for MATLAB to find your component.
Tutorial Task
Enter the appropriate directory for the Parent Directory field.
What you enter for the parent directory depends on where you have MATLAB installed. For example, if your copy of MATLAB is in d:\matlab
, you can select d:\matlab
or d:\matlab\<directory name>
as the parent directory. All the M-files created for the new component will then be placed in d:\matlab
\@cxx_filename
or d:\matlab
\<directory name>
\@cxx_filename
, respectively.
Specifying the Component Description
The description of the component can be anything you want. You should keep the description to one or two sentences. The description appears at the bottom of the Add Components tab in the Setup File Editor.
Tutorial Task
In the Description field, enter
This component creates a random figure and inserts it into the report
.
Subcomponents
If you select the Component can contain subcomponents option, then the component you are creating can have subcomponents or children.
For the tutorial, do not select the Component can contain subcomponents option.
Looking at the New Component Name Page
After you have completed the tutorial tasks, the Component Name page will have the following appearance.
![]() | Entering Component Category Information | Creating Component Attributes | ![]() |