No appropriate method 'TOCObj' for class 'mlreportg​en.report.​TableOfCon​tents'.

1 view (last 30 days)
Hello, I am trying to customize my table of contents in my report as presented the mlreportgen.report.TableOfContents class documentation. However I get an error when I do this
toc = TableOfContents;
toc.TOCObj.NumberOfLevels = 2;
add(rpt, toc);
The error is:
No appropriate method, property, or field 'TOCObj' for class 'mlreportgen.report.TableOfContents'.
Error in Mreport (line 92)
toc.TOCObj.NumberOfLevels = 2;
Has the TOCObj been removed from Matlab or does the error come from somewhere else?
Thank you in advance!

Accepted Answer

Sai Sri Pathuri
Sai Sri Pathuri on 8 Aug 2019
I think you are using MATLAB R2018a version. But the example you are referring is from documentation of R2019a version (which supports the feature of specifying number of levels). The feature to programmatically specify the number of TOC levels is added in R2018b version.
Since you are using MATLAB R2018a, the error is being created (TOCObj is not supported in versions prior to R2018b). Try using MATLAB R2018b or R2019a.
You may refer Enhanced table of contents customization in the following link

More Answers (0)

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!