主要内容

本页采用了机器翻译。点击此处可查看英文原文。

mlreportgen.report.SummaryTable 类

命名空间: mlreportgen.report
超类: mlreportgen.report.Reporter

汇总查找器结果

自 R2022a 起

描述

使用 mlreportgen.report.SummaryTable 类的实例来生成一个表,该表总结了 MATLAB® Report Generator™ 查找器对象搜索的结果。下表列出了每个查找器结果对象的关键属性。有关详细信息,请参阅查找器结果类

mlreportgen.report.SummaryTable 类是一个 handle 类。

类属性

HandleCompatible
true

有关类属性的信息,请参阅类属性

创建对象

描述

summaryTableRptr = mlreportgen.report.SummaryTable 创建一个空的摘要表报告器。使用 FinderResults (Simulink Report Generator) 属性指定要汇总的结果。

注意

向报告中添加空的 MATLAB 摘要表报告器会导致错误。

summaryTableRptr = mlreportgen.report.SummaryTable(finderResults) 为数组 finderResults 中的结果对象创建一个摘要表报告器,并将 FinderResults 属性设置为 finderResults

示例

summaryTableRptr = mlreportgen.report.SummaryTable(Name=Value) 使用名称-值参量设置属性。以任意顺序指定多个名称-值参量。

属性

全部展开

要报告的 Finder 结果对象,指定为 查找器结果类 对象数组(例如 mlreportgen.finder.MATLABVariableResultmlreportgen.finder.AxesResult)。

属性:

GetAccess
public
SetAccess
public

摘要表的标题,指定为字符串、字符向量或 DOM 对象。默认情况下,该属性为空,报告器使用 getDefaultSummaryTableTitle 方法为 finderResults 指定的查找器结果对象创建表标题。

将此属性指定为字符向量或字符串标量将创建一个 mlreportgen.dom.Paragraph 对象,其 Style 属性设置为 "SummaryTableTitleParagraph"

属性:

GetAccess
public
SetAccess
public

要报告的结果类的属性,指定为字符串标量数组或字符向量元胞数组。

如果 Properties 为空,则报告器使用 getDefaultSummaryProperties 指定的查找器结果对象的 finderResults 方法来确定要报告哪些查找器结果对象属性。

摘要表为每个结果包含一行,其条目包含找到的对象的属性。默认情况下,报告的属性取决于结果对象类型。使用摘要表报告器 Properties 属性来自定义要报告的属性集。

使用 getPropertyValues 指定的查找器结果对象的 finderResults 方法来识别可以添加到摘要表中的属性。

属性:

GetAccess
public
SetAccess
public

数据类型: cell

是否将摘要表中每个对象的 Title 属性链接到相应的报告对象,指定为 truefalse

属性:

GetAccess
public
SetAccess
public

数据类型: logical

是否在摘要表中包含空查找器结果对象属性的列,指定为 falsetrue

属性:

GetAccess
public
SetAccess
public

数据类型: logical

表报告器格式化程序类型,指定为 mlreportgen.report.BaseTable 对象。通过自定义默认报告器或用自定义的 BaseTable 报告器替换它来自定义摘要表的外观。

属性:

GetAccess
public
SetAccess
public

方法

全部展开

示例

全部折叠

此示例显示如何为 mlreportgen.report.AxesFinder 对象的结果添加摘要表。

创建 PDF 报告。

import mlreportgen.report.*
import mlreportgen.finder.*

rpt = mlreportgen.report.Report("Summary Table Results","pdf");
add(rpt,TitlePage("Title",sprintf("Summary Table for Axes Finder Results"),"Author",""));

创建图窗手柄和要报告的坐标区。

figH = figure;
ax1 = subplot(3,2,2);
x = linspace(0,20);
y1 = cos(x);
plot(x,y1);
ax1.Title = title("Example Plot 1");

ax2 = subplot(3,2,4);
y2 = sin(tan(x).*x);
plot(x,y2);
ax2.Title = title("Example Plot 2");

创建一个 AxesFinder 对象来查找坐标区。

finderObj = mlreportgen.finder.AxesFinder(figH);
results = find(finderObj);

find 方法的结果传递给 SummaryTable 报告器。

rptr = mlreportgen.report.SummaryTable(results);
rptr.ShowEmptyColumns = true;
append(rpt,rptr);
close(rpt);
rptview(rpt);

详细信息

全部展开

版本历史记录

在 R2022a 中推出