主要内容

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

systemcomposer.rptgen.report.Function 类

命名空间: systemcomposer.rptgen.report
超类: slreportgen.report.Reporter (Simulink Report Generator)

函数报告器

自 R2022b 起

描述

创建一个报告器,报告 System Composer™ 软件架构模型中的所有函数。

systemcomposer.rptgen.report.Function 类是 handle 类。

创建对象

reporter = Function("Source",result) 创建一个报告器,使用 systemcomposer.rptgen.finder.FunctionResult 对象报告函数。

属性

全部展开

函数结果,指定为 systemcomposer.rptgen.finder.FunctionResult 对象。

自定义摘要报告器,指定为报告器对象。默认值为 mlreportgen.report.BaseTable (MATLAB Report Generator) 报告对象。

此报告器的模板来源,以下列方式之一指定:

  • 指定此报告器模板文件路径的字符向量或字符串标量

  • 此报告器所用模板的源报告器或报告(或其模板库包含此模板)

  • 此报告器所用模板的文档对象模型 (DOM) 文档或文档部件(或其模板库包含此报告器的模板)

指定的模板必须与您附加此报告器的报告类型相同。例如,对于 Microsoft® Word 报告,TemplateSrc 必须是 Word 报告器模板。如果 TemplateSrc 属性为空,则此报告器将使用默认报告器模板作为报告的输出类型。

属性:

GetAccess
public
SetAccess
public
NonCopyable
true

此报告器的模板名称,指定为字符向量或字符串标量。该报告器的模板必须位于该报告器的 TemplateSrc 属性指定的模板的模板库中。

属性:

GetAccess
public
SetAccess
public

数据类型: char | string

此报告器的超链接目标,指定为指定链接目标 ID 的字符向量或字符串标量,或 mlreportgen.dom.LinkTarget (MATLAB Report Generator) 对象。字符向量或字符串标量值转换为 LinkTarget 对象。链接目标在输出报告中紧接着此报告器的内容。

属性:

GetAccess
public
SetAccess
public

方法

全部展开

示例

全部折叠

使用 ComponentFinderComponentResultFunctionFinderFunctionResult 类生成报告,查找给定软件架构模型中的所有组件及其函数。

import mlreportgen.report.*
import slreportgen.report.*
import systemcomposer.query.*
import systemcomposer.rptgen.finder.*

打开 ACCSoftwareComposition 模型。

model_name = "ACCSoftwareComposition";
mdl = systemcomposer.loadModel(model_name);

创建一个报告,并追加标题页和目录。

functionsReport = slreportgen.report.Report(OutputPath=model_name + "_FunctionsReport", ...
    CompileModelBeforeReporting=false);
append(functionsReport,TitlePage(Title="Components and their Functions in " + model_name));
append(functionsReport,TableOfContents);

创建一个章节,包含与组件及其函数相关的所有节。

compChapter = Chapter("Components and their Functions");

查找架构模型中的所有组件。

componentFinder = ComponentFinder(model_name);
componentFinder.Query = AnyComponent;

为每个组件创建一个章节。

while hasNext(componentFinder)
    comp = next(componentFinder);
    compSection = Section(Title=comp.Name);
    compReporter = getReporter(comp);
    compReporter.IncludeSnapshot = 1;
    compReporter.IncludeProperties = 0;
    compReporter.IncludeFunctions = 0;
    append(compSection,compReporter);

查找与组件相关的所有函数。

    functionFinder = FunctionFinder(model_name);
    functionFinder.ComponentName = comp.Name;
    functionResult = find(functionFinder);
    append(compSection,functionResult);

    append(compChapter,compSection);
end

将章节附加到报告中,并查看生成的报告。

append(functionsReport,compChapter);
close(functionsReport);
rptview(functionsReport);

版本历史记录

在 R2022b 中推出