Main Content

C Function

Insert information about C Function block contents


This component displays tables with information about the C code and symbols used by a C Function block.

By default, the component reports:

  • A table that includes the Description parameter and any custom mask parameters

  • A table that lists the contents of the Symbols parameter

  • Sections for the C code defined by the Output Code, Start Code, and Terminate Code parameters

You can specify the parameters to report and customize the generated tables.

A C Function component can have the following components as its parent:

  • Model Loop

  • System Loop

  • Block Loop

For details about C Function blocks, see the C Function block reference page.

Object Properties Table

  • Include block object properties: Generates a table with block object property information.

  • Table title: Specifies the table title in the generated report.

    • Automatic: Use the automatically generated title.

    • Custom: Specify a custom title.

  • Header row: Select a header row for the table in the generated report.

    • No header: Includes no header row

    • Type and Name: Includes a header row with columns for the name and object type

    • Custom: Includes a custom header

  • Properties list: Specify whether to have Report Explorer select properties automatically or to list the properties to report on.

    • Determine properties automatically: Let the Report Explorer automatically select the properties to report. The Report Explorer reports the C Function block parameter dialog box prompt properties.

    • Show properties: Specify a list of properties to report. Enter the names of the C Function block properties that you want the report to include.

      Property names often differ from the Simulink® dialog box prompts. To determine the property names of a C Function block, select the block and enter this code at the MATLAB® command line:


  • Display property names as prompts: Display the property names as prompts in the generated report. The report includes the dialog box string instead of the underlying code property.

  • Don't display empty values: Exclude the empty parameters in the generated report.

Symbols Table

  • Include symbols table: Generate a table with information about the symbols used by the C Function block.

  • Table title: Specifies the table title in the generated report.

    • Automatic: Use the automatically generated title.

    • Custom: Specify a custom title.

  • Grid lines: Show grid lines for the table.

  • Spans page width: Make the table as wide as the page.

  • Column alignment: Align the text in each column.

    • Left

    • Center

    • Right

    • Double justified

    You can select any value present from the drop-down list. By default, the Column alignment option is set to Left.

Output, Start, and Terminate Code

  • Which C code to report: When the C Function block is configured to use different C code in generated code than it uses for simulation, choose which code to include in the report.

    • Simulation and code generation code — Include C code used during simulation and C code used in generated code.

    • Simulation code only — Include only C code used during simulation.

    • Code generation code only — Include only C code used in generated code.

    (since R2024a)

  • Include output code: Include the code that the C Function block executes during simulation.

  • Include start code: Include the initialization code of the C Function block.

  • Include terminate code: Include the cleanup code that the C Function block runs at model termination.

Insert Anything into Report?

Yes. Tables and code.