Main Content

Add Global Variables by Using the App

To add global variables to the project:

  1. On the Define Input Types page, automatically define input types or click Let me enter input or global types directly.

    The app displays a table of entry-point inputs.

  2. To add a global variable, click Add global.

    By default, the app names the first global variable in a project g, and subsequent global variables g1, g2, and so on.

  3. Under Global variables, enter a name for the global variable.

  4. After adding a global variable, but before generating code, specify its type and initial value. Otherwise, you must create a variable with the same name in the global workspace. See Specify Global Variable Type and Initial Value Using the App.

The MATLAB® Coder™ app is not supported in MATLAB Online™.