| Simulink® | ![]() |
Lookup Tables

The Lookup Table (n-D) block evaluates
a sampled representation of a function in N variables,
, where the function F might
be known only empirically. The block efficiently maps its inputs to
an output value by looking up or interpolating a table of values as
defined by the block's parameters. The block supports flat (constant),
linear, and cubic spline interpolation methods. You can apply any
of these methods to 1-D, 2-D, 3-D, or higher dimensional tables.
To use this block, specify the number of dimensions of your lookup table using the Number of table dimensions parameter. In the Breakpoints for dimension parameter, enter a breakpoint vector that corresponds to each dimension of your lookup table. Define the associated set of output values as the Table data parameter. You can customize the block's lookup and estimation behaviors by specifying, for example, values for its Index search method, Interpolation method, and Extrapolation method parameters.
The first block input identifies the first dimension (row) breakpoints, the next block input identifies the second dimension (column) breakpoints, and so on. See Changing the Orientation of a Block for a description of the port order for various block orientations.

During simulation, the Lookup Table (n-D) block generates its output by looking up or estimating table values based on its input values:
If the inputs match the values of indices specified in breakpoint vectors, the Lookup Table (n-D) block outputs the table value at the intersection of the row, column, and higher dimension breakpoints.
If the inputs do not match the values of indices specified in breakpoint vectors, the Lookup Table (n-D) block generates output by interpolating appropriate table values. If the inputs are beyond the range of breakpoint vectors, the block can extrapolate its output values.
Alternatively, you can use the Interpolation Using Prelookup block with the Prelookup block to perform the equivalent operation of a Lookup Table (n-D) block. This combination of blocks offers greater flexibility that can result in more efficient simulation performance for linear interpolations in certain circumstances.
For noninterpolated table lookups, use the Direct Lookup Table (n-D) block when the lookup operation is a simple array access, for example, if you have an integer value k and you want the kth element of a table, y = table(k).
The Lookup Table (n-D) block supports all data types supported by Simulink® software, including fixed-point data types. For a discussion on the data types supported by Simulink software, see Data Types Supported by Simulink® in the Simulink documentation.
Inputs for indexing must be real; table data can be complex.
The Main pane of the Lookup Table (n-D) block dialog appears as follows:

Enter the number of dimensions of the Table data parameter by specifying an integer from 1 to 30. This determines the number of independent variables for the table and hence the number of block inputs. It also determines the number of dimensions that appear in the Breakpoints for dimension parameter.
Define breakpoint sets that correspond to the dimensions of the Table data parameter. For each dimension, specify breakpoints as a vector whose values are strictly monotonically increasing.
The breakpoint sets are converted offline to their corresponding input signal's data type using round-to-nearest and saturation.
Select Evenly spaced points, Linear search, or Binary search (the default). Each search method has speed advantages in different circumstances:
If the breakpoint data is evenly spaced, e.g., 10, 20, 30, ..., you can achieve the greatest speed by selecting Evenly spaced points to calculate the table indices.
For irregularly spaced breakpoint sets, if the input signals do not vary much from one time step to the next, selecting Linear search in combination with Begin index search using previous index result produces the best performance.
For irregularly spaced breakpoint sets with rapidly varying input signals that jump more than one or two table intervals per time step, selecting Binary search produces the best performance.
A suboptimal choice of index search method can lead to slow performance of models that rely heavily on lookup tables.
Note The Evenly spaced points algorithm uses only the first two breakpoints to determine the offset and spacing of the remaining points. |
Select this option if you want the block to start its search using the index that was found at the previous time step. For inputs that change slowly with respect to the interval size, enabling this option can improve performance. Otherwise, the linear search and binary search methods might take significantly longer, especially for large breakpoint sets.
Instead of having one input port per independent variable, the block is configured with just one input port that expects a signal that is N elements wide for an N-dimensional table. This might be useful in removing line clutter on a block diagram with many lookup tables.
Specifies whether to produce a warning or error message if the input is out of range. The options are:
None — the default, no warning or error message
Warning — display a warning message in the MATLAB® Command Window and continue the simulation
Error — halt the simulation and display an error message in the Simulation Diagnostics Viewer
The table of output values. During simulation, the matrix size must match the dimensions defined by the Number of table dimensions parameter. However, during block diagram editing, you can enter either an empty matrix (specified as []) or an undefined workspace variable as the Table data parameter. This technique allows you to postpone specifying a correctly dimensioned matrix for the Table data parameter and continue editing the block diagram. For information about how to construct multidimensional arrays in MATLAB, see Multidimensional Arrays in the MATLAB documentation.
The Table data parameter is converted offline to the Output data type using the specified rounding and saturation.
Click the Edit button to open the Lookup Table Editor (see Lookup Table Editor).
Select None - Flat, Linear (the default), or Cubic spline. See Interpolation Methods for more information.
Select None - Clip, Linear (the default), or Cubic spline. See Extrapolation Methods for more information.
Specify the indexing convention that the block uses internally to address the last element of a breakpoint vector and its corresponding table value. If selected, the block addresses the end of a breakpoint vector and its table value using the last element's index and 0 for the interval fraction. Otherwise, the block addresses those same values using the index of the next-to-last breakpoint and 1 for the interval fraction.
This parameter is visible only if the Interpolation method specifies Linear and the Extrapolation method is None - Clip.
Specify the time interval between samples. To inherit the sample time, set this parameter to -1. See Specifying Sample Time for more information.
The Signal Attributes pane of the Lookup Table (n-D) block dialog appears as follows:

Select to require all inputs to have the same data type.
Specify the minimum value that the block should output. The default value, [], is equivalent to -Inf. Simulink software uses this value to perform:
Parameter range checking (see Checking Parameter Values)
Simulation range checking (see Checking Signal Ranges)
Automatic scaling of fixed-point data types
Specify the maximum value that the block should output. The default value, [], is equivalent to Inf. Simulink software uses this value to perform:
Parameter range checking (see Checking Parameter Values)
Simulation range checking (see Checking Signal Ranges)
Automatic scaling of fixed-point data types
Specify the output data type. You can set it to:
A rule that inherits a data type, for example, Inherit: Inherit via back propagation
The name of a built-in data type, for example, single
The name of a data type object, for example, a Simulink.NumericType object
An expression that evaluates to a data type, for example, float('single')
Click the Show data type assistant button
to display the Data
Type Assistant, which helps you set the Output
data type parameter.
See Specifying Block Output Data Types for more information.
Select to lock scaling of outputs. This parameter is visible only if you enter an expression for the Output data type parameter.
Select the rounding mode for fixed-point lookup table calculations that occur during simulation or execution of code generated from the model. For more information, see Rounding in the Simulink® Fixed Point™ User's Guide.
Note that this option does not affect rounding of values of block parameters, such as Table data. Simulink software rounds such values to the nearest representable integer value. To control the rounding of a block parameter, enter an expression using a MATLAB rounding function into the parameter's edit field on the block dialog box.
The Internal Attributes pane of the Lookup Table (n-D) block dialog appears as follows:

Specify the fraction data type. You can set it to:
A rule that inherits a data type, for example, Inherit: Inherit via internal rule
The name of a built-in data type, for example, single
The name of a data type object, for example, a Simulink.NumericType object
An expression that evaluates to a data type, for example, float('single')
Click the Show data type assistant button
to display the Data
Type Assistant, which helps you set the Fraction
data type parameter.
See Using the Data Type Assistant for more information.
Direct Feedthrough | Yes |
Sample Time | Specified in the Sample time parameter |
Scalar Expansion | Yes |
Dimensionalized | Yes |
Zero Crossing | No |
Lookup Table, Lookup Table (2-D), Lookup Table Dynamic
![]() | Lookup Table (2-D) | Lookup Table Dynamic | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |