slreportgen.report.LookupTable Class
Namespace: slreportgen.report
Superclasses: slreportgen.report.Reporter
Lookup table block reporter
Description
Create a Simulink® lookup table block reporter_ See the Object property for a list of supported blocks.
Note
To use a LookupTable
reporter in a report, you must create the
report using the slreportgen.report.Report
class.
The slreportgen.report.LookupTable
class is a handle
class.
Creation
Description
creates an
empty rptr
= LookupTableLookupTable
block reporter based on a default template.
Use its properties to specify the lookup table block on which to report and
specify report options.
creates a rptr
= LookupTable(lutobj
)LookupTable
block reporter for the lookup table
block specified by lutobj
. By default, the reporter
generates a table and a plot of output values versus breakpoints, and a data
types table.
sets rptr
= LookupTable(Name=Value
)LookupTable
reporter properties using name-value pairs.
You can specify multiple name-value pair arguments in any order.
Input Arguments
lutobj
— Lookup table block object
path | handle
See the Object property.
Properties
Object
— Lookup table block
path | handle
Lookup table block to report on, specified as the path or handle of the block.
These lookup table blocks are supported.
Note
If you use a finder to find a Lookup Table block and add it directly
to a report, this LookupTable
reporter is used rather
than a Simulink object property reporter.
IncludeTable
— Include table of lookup table data
true
(default) | false
Whether to include a table of lookup table data, specified as a logical.
If true
, the report includes a table that lists output
values and breakpoints of the lookup table.
For a 1-D lookup table, the data table lists the breakpoints in the first column of the table. The second column lists the corresponding output values.
For a 2-D or greater dimension lookup table, the data table lists the
first set of breakpoints in the first row of the table. It lists the second
set of breakpoints in the first column. The output appears in the
corresponding table cells. For lookup tables greater than 2-D, the
LookupTable
report generator shows slices of the table as
separate output versus breakpoint tables.
IncludePlot
— Include lookup table data plot
true
(default) | false
Whether to include a lookup table data plot, specified as a logical. If
true
, the report includes a plot of the output values
versus the breakpoints of the lookup table block.
For a 1-D lookup table, the plot is a line plot of output values versus breakpoints.
For 2-D tables and slices, the plot is a surface or mesh plot of output
values versus breakpoints. Use the PlotType
property to
specify whether to use a surface or mesh plot.
PlotType
— Plot type for 2-D lookup table data plot
'Surface Plot'
(default) | 'Mesh Plot'
Plot type for a 2-D lookup table data plot, specified as either a character array ('Surface Plot' or 'Mesh Plot') or string ("Surface Plot" or "Mesh Plot").
DataReporter
— Lookup table data reporter
BaseTable
reporter (default) | custom reporter
Lookup table data reporter, specified as a BaseTable
reporter or custom reporter. The LookupTable
reporter uses
the specified reporter to create a table of lookup table data.
To customize the appearance of the table of lookup table data, customize
the default BaseTable
reporter or replace it with a custom
version of the BaseTable
reporter.
To customize the title of the table of lookup table data, specify the
contents in the Title
property of the default or
replacement reporter. The content you specify is placed at the front of the
default title. If the lookup table is too wide to fit legibly on a page, use
the MaxCols
property of the
DataReporter
to generate the table as a set of
slices that fit legibly. To determine an optimal value, iterate setting the
MaxCols
value and viewing the report.
Example: lutable.DataReporter.Title = 'New
Title'
PlotReporter
— Lookup table data plot reporter
Figure
reporter (default) | custom reporter
Lookup table data plot reporter, specified as a Figure
reporter or custom reporter. The LookupTable
reporter uses
the specified reporter to create a plot of output values versus breakpoints
of the lookup table.
To customize the appearance of the plot of the lookup table data,
customize the default Figure
reporter or replace it with a
custom version of the Figure
reporter. To customize the
caption of the plot, specify the contents in the
Caption
property of the default or replacement
reporter. The content you specify is placed at the front of the default
caption.
MaxTableColumns
— Maximum table columns to display
inf
(default) | integer
Maximum number of table columns to display for the output values versus
breakpoints, specified as inf
or an integer. This
property applies only if the IncludeTable
property is
true.
If the number of lookup table columns is greater than the value of this
property, the data is shown only as a surface plot. The plot appears only if
the IncludePlot
property is true.
The default value of this property is inf
, which causes
the reporter to use a table regardless of the size of the lookup table data
array. Depending on the size of the data being displayed, some tables can be
illegible. To avoid creation of illegible tables, change the default setting
of this property to a smaller value.
TemplateSrc
— Source of template for this reporter
character vector | string scalar | reporter or report | DOM document or document part
Source of the template for this reporter, specified in one of these ways:
Character vector or string scalar that specifies the path of the file that contains the template for this reporter
Reporter or report whose template is used for this reporter or whose template library contains the template for this reporter
Document Object Model (DOM) document or document part whose template is used for this reporter or whose template library contains the template for this reporter
The specified template must be the same type as the report to which you
append this reporter. For example, for a Microsoft® Word report, TemplateSrc
must be a Word reporter template.
If the TemplateSrc
property is empty, this reporter uses the
default reporter template for the output type of the report.
TemplateName
— Name of template for this reporter
character vector | string scalar
Name of the template for this reporter, specified as a character vector or string scalar.
The template for this reporter must be in the template library of the template specified by
the TemplateSrc
property of this reporter.
Data Types: char
| string
LinkTarget
— Hyperlink target for this reporter
[]
(default) | character vector | string scalar | mlreportgen.dom.LinkTarget
object
Hyperlink target for this reporter, specified as a character vector or string scalar
that specifies the link target ID, or an mlreportgen.dom.LinkTarget
object. A character vector or string scalar
value converts to a LinkTarget
object. The link target immediately
precedes the content of this reporter in the output report.
Methods
Public Methods
slreportgen.report.LookupTable.createTemplate | Create Simulink lookup table block reporter template |
slreportgen.report.LookupTable.customizeReporter | Create custom LookupTable reporter class |
slreportgen.report.LookupTable.getClassFolder | Lookup Table reporter class definition file location |
copy | Create copy of a Simulink reporter object and make deep copies of certain property values |
getImpl | Get implementation of reporter |
Examples
Customize LookupTable
Reporter Output
This example shows how to add fixed content to a customized
HTML LookupTable
reporter template. You can also customize your
lookup table report output by editing the report generator program directly. The
advantage of customizing a template is that you can reuse it as a basis for
customizing another report generator program.
The template and style sheets for the LookupTable
reporter are
located in the
matlab\toolbox\shared\slreportgen\rpt\rpt\+slreportgen\+report\@LookupTable\resources\templates
folder. You do not need to specify this path when you copy the default
template.
Create a copy of the default html template. In this example, the template package is saved as a zipped file named
CustomTemplate.htmtx
in the current working folder.import mlreportgen.report.* import slreportgen.report.* LookupTable.createTemplate('CustomTemplate','html');
Unzip the template package.
The unzipped template package is a folder of document, style sheet, and image files. In this example, the unzipped folder of files is namedunzipTemplate('CustomTemplate.htmtx');
CustomTemplate
and is saved in the current working folder. Theroot.css
file, which is in thestylesheets
subfolder, defines the styles that control the appearance and formatting of the generated report. Thedocpart_templates.html
file specifies the holes that hold the report contents when the report is generated.From the
CustomTemplate
folder, open thedocpart_templates.html
file in a text editor outside of MATLAB®.<html> <head> <meta charset="utf-8" /> <title>Document Part Templates</title> <link rel="StyleSheet" href="./stylesheets/root.css" type="text/css" /> </head> <body> <dplibrary> <!-- NOTE: temporary in the template library until the --> <! DOM supports a source without template name --> <dptemplate name="LookupTable"> <hole id="Content">LUT_CONTENT</hole> <hole id="LUTDataTypes">DATA_TYPE</hole> <hole id="FootNoteContent">LUT_FOOTNOTE_CONTENT</hole> </dptemplate> <dptemplate name="LookupTableContent"> <hole id="TableContent">TABLECONTENT</hole> <hole id="FigureContent">FIGURECONTENT</hole> </dptemplate> </dplibrary> </body> </html>
To add fixed text to the template, place it in the desired location and use standard HTML tagging. This example adds text that appears above the data types table in the generated report. Only the
<dptemplate name="LookupTable">
portion of the file is shown.<dptemplate name="LookupTable"> <hole id="Content">LUT_CONTENT</hole> <p><scan>This lookup table block contains the following data types:</scan></p> <hole id="LUTDataTypes">DATA_TYPE</hole> <hole id="FootNoteContent">LUT_FOOTNOTE_CONTENT</hole> </dptemplate>
Save the file.
At the MATLAB command line, zip the template folder into a template package. For this example, the template package is zipped to the
CustomTemplate.htmtx
file.zipTemplate('CustomTemplate');
To use the saved template for your report, specify the template source in your report generator program.
lutable = LookupTable(); lutable.TemplateSrc = 'CustomTemplate';
Change Lookup Table Plot Height and Width
Create a PDF report generator that specifies the plot height and width returned by the LookupTable
reporter. This example uses the sf_car
model and reports on its Torque ratio
Lookup Table (n-D) block. This block is a 1-D lookup table and is in the transmission/Torque Converter
subsystem of the sf_car
model. To set the height and width of the plot, use the PlotReporter
property.
import slreportgen.report.* import mlreportgen.report.* model_name = "sf_car"; load_system(model_name); lutable = "sf_car/transmission/Torque Converter/Torque ratio"; rpt = slreportgen.report.Report("output","pdf"); chapter = Chapter(lutable); rptr = LookupTable(lutable); rptr.IncludeTable = false; add(chapter,rptr); rptr_resized = LookupTable(lutable); rptr_resized.IncludeTable = false; rptr_resized.PlotReporter.Snapshot.Width = "3in"; rptr_resized.PlotReporter.Snapshot.Height = "4in"; add(chapter,rptr_resized); add(rpt,chapter); close(rpt) ; close_system(model_name) rptview(rpt);
The default plot on the first page of the report uses predefined sizing to fit the plot to the page size.
The resized plot on the second page of the report uses the specified 3" width and 4" height.
Report on Lookup Table Block
Create a PDF report generator that reports on a lookup table block. This example uses the sf_car
model and reports on its engine torque
Lookup Table (n-D) block. This block is a 2-D lookup table. The engine torque
block is in the Engine
subsystem of the sf_car
model. The report, by default, includes a table of output values versus breakpoints, a surface plot, a table of block data types, and notes about possible differences between reported values and values obtained from simulation.
import slreportgen.report.* import mlreportgen.report.* model_name = "sf_car"; load_system(model_name); lutable = "sf_car/Engine/engine torque"; rpt = slreportgen.report.Report('output','pdf'); chapter = Chapter(lutable); rptr = LookupTable(lutable); add(chapter,rptr); add(rpt,chapter); close(rpt); close_system(model_name); rptview(rpt)
Find and Report on Lookup Tables and Other Blocks
Create a PDF report generator that finds all blocks in the
Engine
subsystem of the sf_car
model.
The report generator program then loops through the blocks and tests whether the
block is a lookup table block. For lookup table blocks, it uses the
LookupTable
reporter to report information about the block.
For other blocks, the generated report reports on block properties, which are
the results of the BlockFinder
class.
Run the following command to access the supporting files used in this example.
openExample('rptgenext/SimulinkReportGeneratorFilesExample');
import slreportgen.report.* import slreportgen.finder.* model_name = "sf_car"; load_system(model_name) subsys_name = "sf_car/Engine"; rpt = slreportgen.report.Report; blkfinder = BlockFinder(subsys_name); blks = find(blkfinder); for i=1:length(blks) if slreportgen.utils.isLookupTable(blks(i).Object) rptr = LookupTable(blks(i).Object); ch = Chapter(blks(i).Name); add(ch,rptr); add(rpt,ch); else ch = Chapter(blks(i).Name); add(ch,blks(i)); add(rpt,ch); end end close(rpt); close_system(model_name); rptview(rpt);
The first chapter shows the default properties reported for Inport block.
The fifth chapter shows the default output for a Lookup Table block reporter. The default output is a table of output values versus breakpoints table, a plot, and a table of data types.
Version History
Introduced in R2018a
MATLAB-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
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)