Main Content

rpt2api

Convert Report Explorer setup files to MATLAB programs

Since R2022b

    Description

    rpt2api(rptPath) converts the specified report setup file to a MATLAB® program that uses the programmatic interface of the MATLAB Report Generator™. The function saves the created MATLAB program file in the current directory, with the same name as the setup file.

    Tip

    You can also access the function interactively from the Export to Report API (since R2024a) command in the File menu of the Report Explorer.

    The function converts supported Report Explorer components. The converter does not convert XSL style sheets associated with report setup files. The converted script includes comments to identify components that are unsupported for conversion. Use the Report API and Document Object Model (DOM) API to add equivalent formatting to the converted program. See Report Generator Development.

    example

    rpt2api(rptPath,mPath) saves the newly created program file in the specified path.

    example

    rpt2api(___,Name=Value) specifies one or more additional name-value arguments.

    example

    Examples

    collapse all

    This example shows how to convert an existing report setup file to a MATLAB program.

    rpt2api("myReportSetupFile.rpt");

    This command creates an M-file in the current directory with the same name as the setup file.

    This example shows how to save the converted script in a specific directory.

    rpt2api("myReportSetupFile.rpt","C:\Work\newFile.m");

    This example shows how to automatically open the script after conversion from the report explorer file.

    rpt2api("myReportSetupFile.rpt",OpenScript=true);

    Input Arguments

    collapse all

    Path to the report setup file to convert, specified as a character vector or string scalar.

    Target path for created MATLAB program file, specified as a character vector or string scalar.

    Name-Value Arguments

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value.

    Example: rpt2api("myReportSetupFile.rpt","apiRepGenerator.m",OpenScript=false)

    Whether to open the created program file in a MATLAB editor, specified as numeric or logical 1 (true) or 0 (false).

    Data Types: logical

    Whether the generated MATLAB program should clear the variables created during the running of the generated program, specified as numeric or logical 0 (false) or 1 (true).

    Example: rpt2api("myReportSetupFile.rpt",OpenScript=false,ClearWorkspace=true)

    Data Types: logical

    Version History

    Introduced in R2022b

    expand all