Matlab Report Generator error using code given in mathworks

7 views (last 30 days)
Hello,
I did try to use the code given here: https://fr.mathworks.com/help/rptgen/ug/create-a-report-generator.html , in order to start learning how to use matlab report generator. But when i run the full code I have this error message:
Cannot find an exact (case-sensitive) match for 'Report'
The closest match is: report in C:\Program Files\MATLAB\R2016b\toolbox\rptgen\rptgen\report.m
Error in wsedrftgyhujikol (line 3)
rpt = Report('magic','html');
I managed to create a file using "report explorer" by typing report in the command window. But no success with code... I would like a bit of help, specially on how to create a report (in code line) to have something flexible.
My target is to build a GUI which able to select which graph should be in the report or not. I hope it is clear enough, if you need other information feel free to ask :)
Best regards,
Baptiste
  1 Comment
jacques baptiste
jacques baptiste on 23 May 2018
There is a mistake in the given code in the line 3... It should be:
rpt = report('magic-square','html');
The report generator part is really not clear (internet code had mistake, help is messy). Even building a report with a setup file and then a program is quite a lot of work, is there a way to do both in once? We can consider this answered...

Sign in to comment.

Accepted Answer

Steven Lord
Steven Lord on 23 May 2018
No, there is no mistake in the code in step 2. The code in step 2 will work as written as long as you have run the code in step 1 first.
You need to either import mlreportgen.report.* (as step 1 recommends, since it's less typing) and run the shorter command in step 2 or use the fully qualified name (which avoids the need to import anything) in step 2. I have tried each of the following in release R2018a and they both worked.
import mlreportgen.report.*
rpt = Report('magic', 'html');
or
rpt = mlreportgen.report.Report('magic', 'html');
  5 Comments
Steven Lord
Steven Lord on 24 May 2018
Yes, that is very relevant.
The documentation to which you linked in the first line of your question is for the most recent release of MATLAB Report Generator, which is currently release R2018a. Because that documentation is for a newer release than the one you're using, it may use functions or functionality introduced after the release you're using. [Checking the Release Notes I can confirm that the objects used on that documentation page were introduced in release R2017b.]
I recommend navigating to the equivalent page in the documentation included in your installation (which will be for the release you're using) and following the instructions it contains. In your installed documentation select MATLAB Report Generator, then "Getting Started". The first tutorial is titled "Create a MATLAB Report" and that seems to be the equivalent of the page to which you linked.
Sean de Wolski
Sean de Wolski on 25 May 2018
I would advise you to upgrade to at least 17b if you are getting started with the Report Generator now.
The mlreportgen.report.* package is new in this release and makes reporting much easier.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!