Main Content
Array layout
Layout (column-major or row-major) code generator uses for array data
Model Configuration Pane: Code Generation / Interface
Description
The Array layout parameter specifies the layout that the code generator uses for array data. The layout can be column-major or row-major.
Settings
Column-major
(default) | Row-major
Column-major
Generates code in column-major array layout. For example, consider matrix
A
, which is a 4x3 matrix:In column-major array layout, the elements of the columns are contiguous in memory.A = 1 2 3 4 5 6 7 8 9 10 11 12
A
is represented in the generated code as:1 4 7 10 2 5 8 11 3 6 9 12
Row-major
Generates code in row-major array layout. For example, for matrix
A
, in row-major array layout, the elements of the rows are contiguous.A
is represented in the generated code as:1 2 3 4 5 6 7 8 9 10 11 12
Select parameter Use algorithms optimized for row-major array layout to enable efficient row-major algorithms.
Recommended Settings
Application | Setting |
---|---|
Debugging | No impact |
Traceability | No impact |
Efficiency | No impact |
Safety precaution | No impact |
Programmatic Use
Parameter: ArrayLayout |
Type: character vector |
Value: 'Column-major' | 'Row-major' |
Default: 'Column-major' |
Version History
Introduced in R2018b