This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Including 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-code function defined in my_function.c and a structure that is defined in my_header.h are included in the chart. MY_FUNCTION simply multiplies its input by 2. The structure in my_header.h is defined as follows:

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

In the model, we access the structure member using the dot notation: MyStruct.a and also with the use of a pointer: gMyStructPointerVar ->b[1].

Was this topic helpful?