This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

mlreportgen.dom.MessageDispatcher class

Package: mlreportgen.dom

DOM message dispatcher


Dispatcher for document generation status messages.


When you create a message dispatcher, the DOM API keeps the dispatcher until the end of the current MATLAB® session. Delete message event listeners to avoid duplicate reporting of message objects during a MATLAB session.


expand all

(Read-only) The value of this property is a filter that determines the types of messages the dispatcher dispatches. You can control which types of messages are dispatched by setting the properties of the filter.

ID for this document element, specified as a character vector. The DOM generates a session-unique ID when it creates the document element. You can specify your own ID.

Tag for document element, specified as a character vector.

A session-unique ID is generated as part of document element creation. The generated tag has the form CLASS:ID, where CLASS is the class of the element and ID is the value of the Id property of the object. You can specify a tag to replace the generated tag.

For example, to make it easier to identify where an issue occurred during document generation, you can specify your own tag value.





Dispatch a document generation status message.


Get the message dispatcher.


collapse all

This example shows how to add a progress message to display when generating a report.

Add a dispatcher and listener to the report.

import mlreportgen.dom.*;
doctype = 'html';
d = Document('test',doctype);
d.Tag = 'My report';
          dispatcher = MessageDispatcher.getTheDispatcher;
l = addlistener(dispatcher,'Message', ...
    @(src,evtdata) disp(evtdata.Message.formatAsText));
dispatch(dispatcher,ProgressMessage('starting chapter',d));
p = Paragraph('Chapter ');
p.Tag = 'chapter title';

Delete the listener to avoid duplicate reporting of message objects during a MATLAB session.


Check the progress messages in the MATLAB Command Window. The starting chapter message appears, in addition to the predefined DOM progress messages.