Include Custom C Code Functions and Structures

This model shows how Stateflow® allows you to incorporate and to call your custom-written C code functions.

In this particular example, a C function defined in my_function.c and a structure that is defined in my_header.h are included in the chart. MY_FUNCTION multiplies its input by two. The structure in my_header.h is defined as follows:

typedef struct { real_T a; int8_T b[10]; } MyStruct;

The model accesses the structure member using the dot notation MyStruct.a and also with the use of the pointer gMyStructPointerVar ->b[1].

Related Topics