| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
Lookup Tables

The Lookup Table Dynamic block computes an approximation to a function y = f(x) using xdat and ydat vectors. The lookup method can use interpolation, extrapolation, or the original values of the input.
Using the Lookup Table Dynamic block, you can change the table data without stopping the simulation. For example, you can incorporate new table data if the physical system you are simulating changes.
The xdat vector is the breakpoint data, which must be strictly monotonically increasing. The value of the next element in the vector must be greater than the value of the preceding element after conversion to a fixed-point data type. Due to quantization, the xdat vector can be strictly monotonic for a floating-point data type, but not after conversion to a fixed-point data type.
The ydat vector is the table data, which is an evaluation of the function at the breakpoint values.
You define the lookup table by feeding xdat and ydat as 1-by-n vectors to the block. To reduce ROM usage by the generated code for this block, you can use different data types for the xdat breakpoint data and the ydat table data. However, these restrictions apply:
The xdat breakpoint data and the x input vector must have the same sign, the same bias, and the same fractional slope. Also, the precision and range for the x input vector must be greater than or equal to the precision and range for the xdat breakpoint data.
The ydat table data and the y output vector must have the same sign, the same bias, and the same fractional slope.
Tip Evenly-spaced breakpoints can make Real-Time Workshop generated code division-free. For more information, see fixpt_evenspace_cleanup in the Simulink documentation and Identify questionable fixed-point operations in the Real-Time Workshop documentation. |
The block uses the input values to generate output using the method you select for the Lookup Method parameter:
| Lookup Method | Action by the Block |
|---|---|
| Interpolation-Extrapolation | Performs linear interpolation and extrapolation of the inputs.
|
| Interpolation-Use End Values | Performs linear interpolation but does not extrapolate outside the end points of the breakpoint data. Instead, the block uses the end values. |
| Use Input Nearest | Finds the element in xdat nearest the current input. The corresponding element in ydat is the output. |
| Use Input Below | Finds the element in xdat nearest and below the current input. The corresponding element in ydat is the output. If there is no element in xdat below the current input, then the block finds the nearest element. |
| Use Input Above | Finds the element in xdat nearest and above the current input. The corresponding element in ydat is the output. If there is no element in xdat above the current input, then the block finds the nearest element. |
Note The Use Input Nearest, Use Input Below, and Use Input Above methods perform the same action when the input x matches a breakpoint value. |
The Lookup Table Dynamic block accepts signals of any numeric data type supported by Simulink software, including fixed-point data types.
The Main pane of the Lookup Table Dynamic block dialog box appears as follows:

Specify the lookup method. For details, see How the Block Generates Output.
The Signal Attributes pane of the Lookup Table Dynamic block dialog box appears as follows:

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, fixdt('double')
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 the output data type setting of this block against changes by the Fixed-Point Tool and the Fixed-Point Advisor. For more information, see Fixed-Point Tool and Fixed-Point Advisor in the Simulink Fixed Point documentation.
Select the rounding mode for fixed-point operations. For more information, see Rounding in the Simulink Fixed Point User's Guide.
If selected, fixed-point overflows saturate. Otherwise, they wrap.
For an example of entering breakpoint and table data, see Entering Data Using the Lookup Table Dynamic Block's Inports in the Simulink User's Guide.
For an example that illustrates the lookup methods that this block supports, see Example Output for Lookup Methods in the Simulink User's Guide.
Direct Feedthrough | Yes |
Scalar Expansion | No |
Zero-Crossing Detection | No |
![]() | Lookup Table (n-D) | Magnitude-Angle to Complex | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |