Unable to replicate example from matlab webiste for Report generator

Good afternoon everybody,
I get a weird error from Matlab when I try to execute the code which is avilable at this web-page https://it.mathworks.com/help/rptgen/ug/create-a-report-generator.html
If I try to execute line by line I'm stopped at the first "append" istance of the script.
What is the reason? Thank you for your help.
import mlreportgen.report.*
import mlreportgen.dom.*
rpt = Report('magic','html');
tp = TitlePage;
tp.Title = 'Magic Squares';
tp.Subtitle = 'Columns, Rows, Diagonals: All Equal Sums';
tp.Author = 'Albrecht Durer';
append(rpt,tp);
Error using append (line 49)
Input must be a string array, character vector, or cell array of character vectors.

댓글 수: 2

Cris LaPierre
Cris LaPierre 2020년 11월 10일
편집: Cris LaPierre 2020년 11월 10일
Works for me in R2020b. What version of MATLAB are you using?

댓글을 달려면 로그인하십시오.

 채택된 답변

Cris LaPierre
Cris LaPierre 2020년 11월 10일

1 개 추천

This example was first introduced in R2018a. It was updated for R2020b to use the append function (previously used add instead).
If you are using R2018a-2020a, try using the release-specific example rather than the one you linked to. For R2020a, the release-specific example can be found at the following url:

댓글 수: 1

Ahhh..ok that's the point.. I'm currently using the R2019a and as you suggested, if I replace append with add it works.
Thank you very much Cris!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

질문:

2020년 11월 10일

댓글:

2020년 11월 18일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by