Main Content

mlreportgen.dom.MessageDispatcher.getTheDispatcher

Class: mlreportgen.dom.MessageDispatcher
Namespace: mlreportgen.dom

Return DOM message dispatcher

Description

mlreportgen.dom.MessageDispatcher.getTheDispatcher returns the DOM message dispatcher. There is only one DOM message dispatcher per MATLAB® session.

example

Examples

expand all

This example shows how to return the DOM message dispatcher and use it to dispatch a progress message.

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));
     
open(d);
dispatch(dispatcher, ProgressMessage('starting chapter',d));

p = Paragraph('Chapter 1');
p.Tag = 'chapter title';
append(d, p);
     
close(d);
rptview('test',doctype);
     
delete (l);
 

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

Version History

Introduced in R2014b

Go to top of page