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

The Lookup Table (2-D) block computes an approximation to some function z = f(x,y) given x, y, z data points. The first input port corresponds to the first table dimension, x. (See Changing the Orientation of a Block in the Simulink® documentation for a description of the port order for various block orientations.)
The Row index input values parameter is a 1-by-m vector of x data points, the Column index input values parameter is a 1-by-n vector of y data points, and the Table data parameter is an m-by-n matrix of z data points. Both the row and column vectors must be monotonically increasing (i.e., the value of the next element in the vector is greater than or equal to the value of the preceding element). However, these vectors must be strictly monotonically increasing (i.e., the value of the next element in the vector is greater than the value of the preceding element) in the following cases:
The input and output data types are both fixed-point.
The input and output data types are different.
The lookup method is not Interpolation-Extrapolation.
The matrix of output values is complex.
Minimum, maximum, and overflow logging is on.
The block generates output based on the input values using one of these methods selected from the Lookup method parameter list:
Interpolation-Extrapolation — This is the default method; it performs linear interpolation and extrapolation of the inputs.
If the inputs match row and column parameter values, the output is the value at the intersection of the row and column.
If the inputs do not match row and column parameter values, then the block generates output by linearly interpolating between the appropriate row and column values. If either or both block inputs are less than the first or greater than the last row or column values, the block extrapolates using the first two or last two points.
Interpolation-Use End Values — This method performs linear interpolation as described above but does not extrapolate outside the end points of x and y. Instead, the end-point values are used.
Use Input Nearest — This method does not interpolate or extrapolate. Instead, the elements in x and y nearest the current inputs are found. The corresponding element in z is then used as the output.
Use Input Below — This method does not interpolate or extrapolate. Instead, the elements in x and y nearest and below the current inputs are found. The corresponding element in z is then used as the output. If there are no elements in x or y below the current inputs, then the nearest elements are found.
Use Input Above — This method does not interpolate or extrapolate. Instead, the elements in x and y nearest and above the current inputs are found. The corresponding element in z is then used as the output. If there are no elements in x or y above the current inputs, then the nearest elements are found.
For information about creating a table with step transitions, see Representing Discontinuities.
To avoid parameter saturation errors, the Simulink® Fixed Point™ software's automatic scaling script employs a special rule for the Lookup Table (2-D) block. autofixexp modifies the scaling by using the output lookup values in addition to the logged minimum and maximum simulation values. The output lookup values are converted to the specified output data type. This prevents the data from being saturated to different values.
The Lookup Table (2-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.
The Main pane of the Lookup Table (2-D) block dialog appears as follows:

The row values for the table, entered as a vector. The vector values must increase monotonically.
The Row index input values parameter is converted offline to the corresponding input signal's data type using round-to-nearest and saturation.
The column values for the table, entered as a vector. The vector values must increase monotonically.
The Column index input values parameter is converted offline to the corresponding input signal's data type using round-to-nearest and saturation.
Click the Edit button to open the Lookup Table Editor (see Lookup Table Editor).
The table of output values. The matrix size must match the dimensions defined by the Row and Column parameters.
The Table data parameter is converted offline to the Output data type using the specified rounding and saturation.
Specify the lookup method. See Description for a discussion of the options for this parameter.
Specify the time interval between samples. To inherit the sample time, set this parameter to -1. See Specifying Sample Time in the online documentation for more information.
The Signal Attributes pane of the Lookup Table (2-D) block dialog appears as follows:

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
Select to require all inputs to have the same data type.
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 operations. For more information, see Rounding in the Simulink® Fixed Point™ User's Guide.
Note that block parameters such as Table data are always rounded to the nearest representable value. To control the rounding of a block parameter, enter an expression using a MATLAB® rounding function into the mask field.
Select to have overflows saturate.
In this example, the block parameters are defined as
Row index input values: [1 2] Column index input values: [3 4] Table data: [10 20; 30 40]
The first figure shows the block outputting a value at the intersection of block inputs that match row and column values. The first input is 1 and the second input is 4. These values select the table value at the intersection of the first row (row parameter value 1) and second column (column parameter value 4).

In the second figure, the first input is 1.7 and the second is 3.4. These values cause the block to interpolate between row and column values, as shown in the table at the left. The value at the intersection (28) is the output value.

Direct Feedthrough | Yes |
Sample Time | Specified in the Sample time parameter |
Scalar Expansion | Yes, of one input if the other is a vector |
Dimensionalized | Yes |
Zero Crossing | No |
Lookup Table, Lookup Table (n-D)
![]() | Lookup Table | Lookup Table (n-D) | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |