This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

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 the mdlInitializeSizes to set the array layout of the S-function. If the SSArrayLayout specified for the S-function is different from the value specified for model configuration parameter Array layout (Simulink Coder), Simulink® Coder™ reports an error. You can turn off the error by changing the External functions compatibility for row-major code generation (Simulink Coder) to warning or none.

The enumerated type SSArrayLayout defines the set of values that arrayLayout can 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, SSArrayLayout is set to SS_UNSET.

Set SSArrayLayout as SS_ALL if your S-function is not affected by the array layout. The generated code does not affect cache performance.

When running row-major simulations in Accelerator 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