Specify array layout of the S-function
void ssSetArrayLayoutForCodeGen(SimStruct *S, SSArrayLayout arrayLayout)
SimStruct representing an S-Function block.
Array layout of the S-function.
Specify the array layout of the user-defined S-function. Use this macro in themdlInitializeSizes
to set the array layout of the S-function. If theSSArrayLayout
specified for the S-function is different from the value specified for model configuration parameterArray layout(Simulink Coder),金宝app®Coder™reports an error. You can turn off the error by changing theExternal functions compatibility for row-major code generation(Simulink Coder)towarning
ornone
.
The enumerated typeSSArrayLayout
defines the set of values thatarrayLayout
can have.
Array Layout Value |
Majority Supported |
---|---|
|
Unspecified |
|
Column-major |
|
Row-major |
|
Column-major or row-major |
By default,SSArrayLayout
is set toSS_UNSET
.
SetSSArrayLayout
asSS_ALL
if your S-function is not affected by the array layout. The generated code does not affect cache performance.
行模拟在加速器运行时and Rapid Accelerator modes, Simulink uses the S-function's MEX files instead of inlining the S-function by using the Target Language Compiler (TLC).
C, C++
Specify the S-function for column-major code generation:
static void mdlInitializeSizes(SimStruct *S) { ssSetArrayLayoutForCodeGen(S, SS_COLUMN_MAJOR); }
Specify the S-function for row-major code generation:
static void mdlInitializeSizes(SimStruct *S) { ssSetArrayLayoutForCodeGen(S, SS_ROW_MAJOR); }
Specify the S-function for column-major or row-major code generation:
static void mdlInitializeSizes(SimStruct *S) { ssSetArrayLayoutForCodeGen(S, SS_ALL); }
Generate Row-Major Code for S-Functions(Simulink Coder)