Main Content

ssSetArrayLayoutForCodeGen

Specify array layout of the S-function

Syntax

void ssSetArrayLayoutForCodeGen(SimStruct *S, SSArrayLayout arrayLayout)

Arguments

S

SimStruct representing an S-Function block.

arrayLayout

Array layout of the S-function.

Description

Specify the array layout of the user-defined S-function. Use this macro in themdlInitializeSizesto set the array layout of the S-function. If theSSArrayLayoutspecified 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)towarningornone.

The enumerated typeSSArrayLayoutdefines the set of values thatarrayLayoutcan have.

Array Layout Value

Majority Supported

SS_UNSET

Unspecified

SS_COLUMN_MAJOR

Column-major

SS_ROW_MAJOR

Row-major

SS_ALL

Column-major or row-major

By default,SSArrayLayoutis set toSS_UNSET.

SetSSArrayLayoutasSS_ALLif 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).

Languages

C, C++

Examples

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); }

Introduced in R2018b