User`s guide
Display Report Generation Messages
13-107
2
Use the MessageDispatcher.Filter property to specify to display debug
messages.
dispatcher.Filter.DebugMessagesPass = true;
3
Add a listener using the MATLAB addlistener function. Specify the dispatcher
object, the source and event data, and a disp function that specifies the event data
and format to use for the message.
l = addlistener(dispatcher,'Message', ...
@(src, evtdata) disp(evtdata.Message.formatAsText));
4
Include a code to delete the listener. Place it after the code that generates the report.
delete(l);
This report displays debug messages.
import mlreportgen.dom.*;
d = Document('test','html');
dispatcher = MessageDispatcher.getTheDispatcher;
dispatcher.Filter.DebugMessagesPass = true;
l = addlistener(dispatcher,'Message', ...
@(src, evtdata) disp(evtdata.Message.formatAsText));
open(d);
p = Paragraph('Chapter ');
p.Tag = 'chapter title';
p.Style = { CounterInc('chapter'),...
CounterReset('table'),WhiteSpace('pre') };
append(p, AutoNumber('chapter'));
append(d,p);
close(d);
rptview('test','html');
delete(l);
Create and Display a Progress Message
This example shows how to create and dispatch a progress message. You can use a
similar approach for other kinds of messages, such as warnings.