主要内容

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

mlreportgen.dom.ErrorMessage 类

命名空间: mlreportgen.dom

错误消息

描述

指定来自指定源对象的错误消息文本。

mlreportgen.dom.ErrorMessage 类是一个 handle 类。

创建对象

描述

errorMsgObj = ErrorMessage(text,sourceObject) 使用来自指定源对象的指定文本创建错误消息。

示例

输入参量

全部展开

要显示的消息文本,指定为字符向量或字符串标量。

消息源自的 DOM 对象。

属性

全部展开

消息源自的源 DOM 对象。

属性:

GetAccess
public
SetAccess
Transient
true

消息文本,指定为字符向量或字符串标量。

属性:

GetAccess
public
SetAccess
public
Transient
true
NonCopyable
true

数据类型: char | string

标记,指定为字符向量或字符串标量。DOM API 在创建此对象的过程中生成一个会话唯一标记。生成的标记形式为 CLASS:ID,其中 CLASS 是对象类,ID 是对象的 Id 属性的值。使用此值来帮助确定在文档生成过程中出现的问题的位置。

属性:

GetAccess
public
SetAccess
public
NonCopyable
true

数据类型: char | string

目标标识符,指定为字符向量或字符串标量。DOM API 在创建文档元素对象时会生成一个会话唯一标识符。

属性:

GetAccess
public
SetAccess
public
NonCopyable
true

数据类型: char | string

方法

全部展开

示例

全部折叠

import mlreportgen.dom.*;
d = Document('test','html');
     
dispatcher = MessageDispatcher.getTheDispatcher;
l = addlistener(dispatcher,'Message', ...
      @(src, evtdata) disp(evtdata.Message.formatAsText));
     
open(d);
dom.Document:242 opening
dom.Document:242 parsing template "/mathworks/devel/bat/filer/batfs2566-0/Bdoc25a.2864802/build/runnable/matlab/toolbox/shared/mlreportgen/dom/resources/templates/html/default.htmtx"
dom.Document:242 appended dom.TemplateText:260
dom.Document:242 appended dom.TemplateText:263
dom.Document:242 appended dom.TemplateText:266
dom.Document:242 moved to hole "#start#"
dispatch(dispatcher,ErrorMessage('invalid chapter',d));
dom.Document:242 invalid chapter
p = Paragraph('Chapter ');
p.Tag = 'chapter title';
p.Style = {CounterInc('chapter'),...
    CounterReset('table'),WhiteSpace('pre')};
append(p,AutoNumber('chapter'));
append(d,p);
dom.Document:242 appended chapter title
close(d);
dom.Document:242 appended dom.TemplateText:281
dom.Document:242 moved to hole "#end#"
dom.Document:242 closed
rptview(d.OutputPath);

删除侦听程序以避免在 MATLAB® 会话期间重复报告消息对象。

delete(l);

版本历史记录

在 R2014b 中推出