Main Content


Generate MATLAB function report



    report = getReport(config) returns the MATLABFunctionReport object for a MATLAB Function block. Use the MATLABFunctionReport object to access information about the functions and variables used by the MATLAB Function block.


    collapse all

    Access the MATLABFunctionConfiguration object for the MATLAB Function block in the model call_stats_block1 described in Create Custom Functionality Using MATLAB Function Blocks.

    config = get_param('call_stats_block1/MATLAB Function', ...

    Create the MATLABFunctionReport object for the MATLAB Function block.

    report = getReport(config);

    Access the coder.Function objects in the report.

    functions = report.Functions;

    Create a custom report that lists the functions and variables in the MATLAB Function block.

    for i = 1:numel(functions)
        fprintf('Function %s uses these variables:\n',functions(i).Name)
        variables = functions(i).Variables;
        for j = 1:numel(variables)
            fprintf('%d. %s -- %s\n',j,variables(j).Name,variables(j).Scope)
    Function stats uses these variables:
    1. mean -- Output
    2. stdev -- Output
    3. vals -- Input
    4. len -- Local
    Function avg uses these variables:
    1. mean -- Output
    2. array -- Input
    3. size -- Input

    Input Arguments

    collapse all

    MATLAB Function block property configuration, specified as a MATLABFunctionConfiguration object.


    The first time that you create a MATLABFunctionReport object or open the MATLAB function report, Simulink® automatically updates your model. If you make subsequent changes to the MATLAB code in the block, you must update your model before you generate a new MATLABFunctionReport object. Otherwise, the object does not reflect your changes. From the Modeling tab, select Update Model, or press Ctrl+D. For more information, see Update Diagram and Run Simulation.

    Introduced in R2021a