Package: mlreportgen.report
MATLAB variable reporter
Create a reporter that reports on a MATLAB® variable.
creates a MATLAB variable reporter based on a default template. Before adding this reporter to a
report, use its properties to specify the variable name on which to report.rptr
= mlreportgen.report.MATLABVariable()
rptr = mlreportgen.report.MATLABVariable(variable)
creates
a MATLAB variable reporter for the specified MATLAB
variable
. To specify a local variable, specify its name, for example,
MATLABVariable(x)
. To specify a MATLAB workspace variable, specify its name as a string or character array, for
example, MATLABVariable('x')
. To specify other report options, use the
properties of this reporter.
creates a MATLAB variable reporter with options specified by one or more
rptr
= mlreportgen.report.MATLABVariable(Name,Value
)Name,Value
pair arguments. Name
is a property name
and Value
is the corresponding value. Name
must appear
inside single (''
) or double (""
) quotes. You can
specify several name-value pair arguments in any order as
Name1,Value1,...,NameN,ValueN
.
Instead of specifying the MATLAB variable using its Name
,
Value
pair, you can specify it using only its value, but it must be the
first input argument. For example, for a global MATLAB variable named x
,
you can use either mlreportgen.report.MATLABVariable(x,"Location","Global")
or
mlreportgen.report.MATLABVariable("Variable","x","Location","Global")
.
createTemplate | Create MATLAB variable template |
customizeReporter | Create custom MATLAB variable reporter class |
getClassFolder | MATLAB variable class definition file location |
getVariableValue | Get MATLAB variable value |
setVariableValue | Set the value to report for a variable |
This example shows how to report on MATLAB variables. The local variable uses only its
name as input to the MATLABVariable
class and the workspace variable uses a
string. The first part of the example uses default property settings and the second part
changes the display to a table.
Note
Before you run this example, create this variable in the base MATLAB workspace:
workspace_var = ['Workspace variable input ',... 'specified as a string'];
rpt = mlreportgen.report.Report("MyReport","pdf"); local_var = ['Local variable input specified ',... 'using its variable name']; chapter = mlreportgen.report.Chapter(); chapter.Title = "MATLAB Variable Reporter Example"; % Format using default paragraphs rptr_local1 = mlreportgen.report.MATLABVariable... (local_var); rptr_workspace1 = mlreportgen.report.MATLABVariable... ("workspace_var"); add(chapter,rptr_local1) add(chapter,rptr_workspace1) % Format as a table rptr_local2 = mlreportgen.report.MATLABVariable... (local_var); rptr_workspace2 = mlreportgen.report.MATLABVariable... ("workspace_var"); rptr_local2.FormatPolicy = 'Table'; rptr_workspace2.FormatPolicy = 'Table'; add(chapter,rptr_local2) add(chapter,rptr_workspace2) add(rpt,chapter) close(rpt) rptview(rpt)