| 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 Interpolation Using Prelookup block works best with the Prelookup block. The Prelookup block calculates the index and interval fraction that specifies how its input value relates to the breakpoint data set. You feed the resulting index and fraction values into an Interpolation Using Prelookup block to interpolate an n-dimensional table. This combination of blocks performs the same operation that a single instance of the Lookup Table (n-D) block performs. However, the Prelookup and Interpolation Using Prelookup blocks offer greater flexibility that can provide more efficient simulation and code generation.
To use this block, you must define a set of output values as the Table data parameter. Typically, these table values correspond to the breakpoint data sets specified in Prelookup blocks. The Interpolation Using Prelookup block generates output by looking up or estimating table values based on index and interval fraction values fed from Prelookup blocks. The index and interval fraction appear on the Interpolation Using Prelookup block as k and f, respectively.
| If the inputs... | The Interpolation Using Prelookup block... |
|---|---|
| Match the values of indices in breakpoint data sets | Outputs the table value at the intersection of the row, column, and higher dimension breakpoints |
| Do not match the values of indices in breakpoint data sets, but are within range | Interpolates appropriate table values, using the Interpolation method you select |
| Do not match the values of indices in breakpoint data sets, and are out of range | Extrapolates the output value, using the Extrapolation method you select |
You can use the Number of sub-table selection dimensions parameter to specify that interpolation occur only on a subset of the table data. To activate this interpolation mode, set this parameter to a positive integer. This value defines the number of dimensions to select, starting from the highest dimension of table data. Therefore, the value must be less than or equal to the Number of table dimensions.
Suppose that you have 3-D table data in your Interpolation Using Prelookup block. The following behavior applies.
| Number of Selection Dimensions | Action by the Block | Block Appearance |
|---|---|---|
| 0 | Interpolates the entire table and does not activate subtable selection | Does not change |
| 1 | Interpolates the first two dimensions and selects the third dimension | Displays an input port with the label sel1 that you use to select and interpolate 2-D tables |
| 2 | Interpolates the first dimension and selects the second and third dimensions | Displays two input ports with the labels sel1 and sel2 that you use to select and interpolate 1-D tables |
For an example of interpolating a subset of table data, type sldemo_bpcheck at the MATLAB command prompt.
The Interpolation Using Prelookup block accepts real signals of any numeric data type supported by Simulink software, except Boolean. The Interpolation Using Prelookup block supports fixed-point data types for signals, table data, and intermediate results.
For more information, see Data Types Supported by Simulink in the Simulink documentation.
The Main pane of the Interpolation Using Prelookup block dialog box appears as follows:

The number of dimensions that the Table data parameter must have. This value defines the number of independent variables for the table and the number of inputs to the block. Enter an integer between 1 and 30 into this field.
The table of output values. During simulation, the matrix size must match the dimensions defined by the Number of table dimensions parameter. Note that during block diagram editing, you can enter an empty matrix (specified as []) or an undefined workspace variable as the Table data parameter. Use this behavior 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 software, see Multidimensional Arrays in the MATLAB online documentation.
Click the Edit button to open the Lookup Table Editor (see Lookup Table Editor in the Simulink documentation).
None - Flat or Linear. See Interpolation Methods in the Simulink documentation for more information.
None - Clip or Linear. See Extrapolation Methods in the Simulink documentation for more information. The Extrapolation method parameter is visible only if you select Linear as the Interpolation method parameter.
Specifies whether to produce a warning or error message if the input is out of range. Options include:
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
Specifies whether Real-Time Workshop generated code checks the validity of index values that feed this block.
This check box has no effect on generated code if one of the following is true:
The Prelookup block feeds index values to the Interpolation Using Prelookup block.
Because index values from the Prelookup block are always valid, no check code is necessary.
The data type of the input signal restricts the data to valid index values.
For example, unsigned integer data types guarantee nonnegative index values. Therefore, unsigned inputs do not require check code for negative values.
Specifies how the block inputs for index (k) and interval fraction (f) access the last elements of the n-dimensional table in Table data. Index values are zero-based.
| If this check box is... | The block returns the value of the last element in a dimension of its table when... |
|---|---|
| Selected |
|
| Not selected |
|
This check box is visible only when:
Interpolation method is Linear.
Extrapolation method is None - Clip.
Tip If you select Valid index input may reach last index for an Interpolation Using Prelookup block, you must also select Use last breakpoint for input at or above upper limit for all Prelookup blocks that feed it. This action allows the blocks to use the same indexing convention when accessing the last elements of their Breakpoint data and Table data parameters. |
Specifies the number of dimensions of the subtable that the block uses to compute the output. Follow these rules:
To enable subtable selection, enter a positive integer.
This integer must be less than or equal to the Number of table dimensions.
To disable subtable selection, enter 0 (the default) to interpolate the entire table.
For more information, see How The Block Interpolates a Subset of Table Data.
Specify the time interval between samples. To inherit the sample time, set this parameter to -1. See How to Specify the Sample Time in the Simulink documentation for more information.
The Signal Attributes pane of the Interpolation Using Prelookup block dialog box 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
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(1,16,0)
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 all data type settings 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.
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. Otherwise, overflows wrap.
When you select this check box, saturation applies to every internal operation on the block, not just the output or result. In general, the code generation process can detect when overflow is not possible, in which case, no saturation code is necessary.
The Table Attributes pane of the Interpolation Using Prelookup block dialog box appears as follows:

Specify the minimum value for table data. The default value, [], is equivalent to -Inf.
Specify the maximum value for table data. The default value, [], is equivalent to Inf.
Specify the table data type. You can set it to:
A rule that inherits a data type, for example, Inherit: Same as output
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(1,16,0)
Click the Show data type assistant button
to display the Data
Type Assistant, which helps you set the Table
data type parameter.
Tip Specify a table data type different from the output data type for these cases:
|
The Intermediate Attributes pane of the Interpolation Using Prelookup block dialog box appears as follows:

Specify the intermediate results data type. You can set it to:
A rule that inherits a data type, for example, Inherit: Same as output
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(1,16,0)
Click the Show data type assistant button
to display the Data
Type Assistant, which helps you set the Intermediate
results data type parameter.
See Examples for Prelookup and Interpolation Blocks in the Simulink documentation.
Direct Feedthrough | Yes |
Sample Time | Specified in the Sample time parameter |
Scalar Expansion | Yes |
Dimensionalized | Yes |
Zero-Crossing Detection | No |
![]() | Integrator | Interval Test | ![]() |

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 |