import mlreportgen.report.*
rpt = Report('newreport');
rpt.Layout.PageNumberFormat = 'n';
tp = TitlePage();
tp.Title = 'New Report';
tp.Author = 'MathWorks';
append(rpt,tp);
toc = TableOfContents();
toc.Layout.PageNumberFormat = 'i';
append(rpt,toc);
ch = Chapter();
ch.Title = 'Introduction';
sec = Section('First Section of Chapter 1');
txt = ['This is the first section of chapter 1. ',...'The page number format is Arabic numbers, ',...'which is the default for the report.'];
append(sec,txt);
append(ch,sec);
append(rpt,ch);
ch = Chapter();
ch.Title = '2nd chapter';
sec = Section('First Section of Chapter 2');
txt = ['This is the first section of chapter 2. ',...'The page number format is Arabic numbers, ',...'which is the format defined for the report.'];
append(sec,txt);
append(ch,sec);
append(rpt,ch);
close(rpt);
rptview(rpt);