After playing around with my matlab script a bit more, then I realize that my original question doesn not make sense.
It turns out that it is these lines that will create the pdf file (maybe 0 byte).
rpt = mlreportgen.report.Report([mfilename('fullpath'), '.pdf']);
tp = mlreportgen.report.TitlePage;
tp.Title = 'Magic Squares';
tp.Subtitle = 'Columns, Rows, Diagonals: All Equal Sums';
tp.Author = 'Albrecht Durer';
append(rpt,tp);
Then it is the line that creates the final PDF file
close(rpt)
Am I correct?