Global Variables

This page allows you to give Modelify more information about how a global variable should be converted. Global variables that are constant can be configured to be converted as a Constant Block or as Inports and Outports. If a global variable is a pointer, Modelify may not be able to determine the size of the pointer and this page can be used to configure the dimension of the global variable.

The table in this page will automatically be populated with the global variables that are used in the project.

To change how a constant global variable is converted, click in the cell in the Simulink Block column and a drop down box will appear with the options Constant Block and Inport/Outport Block. This is only enabled for constant global variables.

To change the dimension of a pointer global variables, click in the cell in the Dimension column. The cell will become editable and you can enter a dimension for the global variable. The value -1 can be used if the global variable should inherit its dimension from an input.

For global variables that are not constant and are not a pointer, no configuration is necessary.

The page also contains the following:

Configure Simulink.Signal creation to support Embedded Coder

Steps below show how to configure Simulink.Signal objects for ports to specify code generation options.

  1. Check the Apply Simulink.Signal object to ports(Embedded Coder) checkbox. This enables the below three columns in the table to configure the creation of Simulink.Signal objects. Note that Modelify will automatically fill out Header File and/or Definition File columns using the information of the place where the global variable is declared/defined. These values can be changed as desired.
  2. Convert functions that use configured global variables.
  3. Simulink.Signal objects are created in the initialization file. It is also possible to perform manual changes in the initialization file; however note that a future conversion could override those manual edits.

The image below shows an example of an M-Script initialization file with Simulink.Signal objects.