Define an Alias Type in a C Function Block
This example shows how to specify alias data types in a C Function block. The model reads in a source and header file from the Configuration Parameters > Simulation Target pane. Calculations are performed using the functions in the source file.
Simulink.importExternalCTypes('multiply_func.h'); open_system('mCFunction_AliasType');
Define an Alias type in the header file
To define an alias type in your C source code to be used in your C Function
block, use the typedef
keyword. In this example, a double alias is defined as typedef double doubleAlias
in the multiply_func.h
file.
Specify the alias types in the C Function block
You must define your symbols in the Symbols table of the C Function block parameters. Define the symbols in the block as alias types by entering the alias type in the Type column of the Symbols table.