Main Content

mlreportgen.report.TextFile.customizeReporter

Class: mlreportgen.report.TextFile
Namespace: mlreportgen.report

Create custom TextFile reporter class

Since R2023a

Syntax

reporter = mlreportgen.report.TextFile.customizeReporter(classpath)

Description

reporter = mlreportgen.report.TextFile.customizeReporter(classpath) creates a text file class definition file that is a subclass of mlreportgen.report.TextFile at the location specified by classpath. The TextFile.customizeReporter method copies the default text file templates to the <classpath>/resources/template folder. You can use the class definition file as a starting point to design a custom TextFile reporter class for your report.

Input Arguments

expand all

Path and name of the new class definition file, specified as a string scalar or character vector.

ValueDescription
mlreportgen.report.TextFile.customizeReporter("myFolder/MyClass")Create MyClass.m in the subfolder myFolder of the current folder.
mlreportgen.report.TextFile.customizeReporter("myFolder/@MyClass")

Create the reporter class in a class folder by preceding the class name with the @ character. Do not specify the .m extension.

See Folders Containing Class Definitions.

mlreportgen.report.TextFile.customizeReporter("+myOrg/@MyClass")Create the reporter class in a class namespace by preceding the folder name with the + character.

Note

You can specify a relative path or an absolute path.

Data Types: string | char

Output Arguments

expand all

Path and file name of the new reporter class, returned as a string scalar.

Examples

Create Custom Text File Reporter

Create a custom text file reporter and its associated default templates. The method creates the derived class file at the specified path relative to the current working folder. In this case, the path to the MyTextFile.m class file is <current working folder>/newTextFile/@MyTextFile/myTextFile.m. The default title page templates are in the <current working folder>/newTextFile/@MyTextFile/resources/templates folder.

import mlreportgen.report.*
TextFile.customizeReporter("newTextFile/@MyTextFile");

After editing this new class file, you can use it as your text file section reporter.

tf = MyTextFile();

Version History

Introduced in R2023a