Main Content

Row-Major Algorithm in Existing Models Containing Lookup Table Blocks

The Direct Lookup Table (n-D), Interpolation Using Prelookup, and n-D Lookup Table blocks have algorithms that work with row-major array layouts or column-major array layouts. This capability requires a Simulink® Coder™ license. For more information on row-major support, see Code Generation of Matrices and Arrays (Simulink Coder).

Prior to R2018b, lookup table blocks supported only column-major array layouts. When selecting algorithms optimized for row-major array layout for a model previously configured for algorithms optimized for column-major array layout, you may need to preserve lookup table block semantics. For example, if a model contains lookup table blocks configured like these:

  • An Interpolation Using Prelookup block configured with a subtable selection before interpolation.

  • A Direct Lookup Table (n-D) configured for a vector or 2-D matrix output

Use the permute function to rearrange the dimensions of the array and preserve the semantics.

For an example of preserving semantics by using table permutations, see Direct Lookup Table Algorithm for Row-Major Array Layout (Simulink Coder) .

For an example of converting column-major arrays to row-major arrays see Column-Major Layout to Row-Major Layout Conversion of Models with Lookup Table Blocks (Simulink Coder).

See Also

| |