Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

Lookup Table 1D Function

LabVIEW 2012 Control Design and Simulation Module Help

Edition Date: June 2012

Part Number: 371894G-01

»View Product Info

Owning Palette: Lookup Tables Functions

Requires: Control Design and Simulation Module

Returns the y value, located in a one-dimensional table, that corresponds to an x value you specify.

Details  Example

Dialog Box Options
Block Diagram Inputs
Block Diagram Outputs

Dialog Box Options

ParameterDescription
Polymorphic instanceSpecifies whether this function is Scalar or Vector. The default value is Scalar.
ParametersLists all the parameters associated with this function. Select a parameter from this list to configure the parameter. When you select a parameter, the parameter and its associated Parameter source control appear in the Parameter Information section of the configuration dialog box.
PreviewDisplays a graphical preview, if available, of the function output or configuration.
Parameter InformationContains the parameters you can configure for this function. You must select a parameter from the Parameters list to make that parameter and its associated Parameter source control visible in the Parameter Information section of the configuration dialog box.
Parameter sourceSpecifies whether you configure this parameter using the Configuration Dialog Box or a Terminal on the simulation diagram. The default value is Configuration Dialog Box. If you select Terminal, LabVIEW displays an input for that parameter on the simulation diagram, and you can wire values to that input to configure this function programmatically. If you select Configuration Dialog Box, LabVIEW removes that input from the simulation diagram. You then must set the value for this parameter inside the configuration dialog box.
MethodSpecifies the interpolation method the lookup table uses. You can choose from the following options:
  • Interpolate/Extrapolate—(Default) If the given X Val lies between two points in the LUT X set, the result is a linear interpolation of the LUT Data values that correspond to the two LUT X points. If the given X Val lies outside the range of the LUT X set, the result is a linear extrapolation of the LUT Data values that correspond to the nearest two LUT X points.

    For an interpolation example, given LUT X is [0 1 5], LUT Data is [4 2 8], and X Val is 4, the two LUT X values that are nearest to the given X Val are 1 and 5. These points represent the x coordinates of a set of points on a line. The LUT Data values that correspond to those LUT X values are 2 and 8, which represent the corresponding y coordinates of the points on the line. This function calculates the slope of the line as (8 – 2) / (5 – 1) = 1.5. This function then uses the slope to interpolate linearly the y value when x is 4. Therefore, the Result is 6.5.

    For an extrapolation example, given LUT X is [0 1 5], LUT Data is [4 2 8], and X Val is 6, the two LUT X values that are nearest to the given X Val are 1 and 5. These points represent the x coordinates of a set of points on a line. The LUT Data values that correspond to those LUT X values are 2 and 8, which represent the corresponding y coordinates of the points on the line. This function calculates the slope of the line as (8 – 2) / (5 – 1) = 1.5. This function then uses the slope to extrapolate linearly the y value when x is 6. Therefore, the Result is 9.5.
  • Interpolate—If the given X Val lies between two points in the LUT X set, the result is a linear interpolation of the LUT Data values that correspond to the two LUT X points. If the given X Val is out of range, the result is the LUT Data value that corresponds to the value of LUT X closest to X Val.
  • Nearest—If the given X Val lies between two points in the LUT X set, the result is the LUT Data value that corresponds to the LUT X point whose value is nearest to the given X Val.

    For example, given LUT X is [0 1 5], LUT Data is [4 2 8], and X Val is 4, the LUT X value that is nearest to the given X Val is 5. The LUT Data value that corresponds to an LUT X value of 5 is 8. Therefore, the Result is 8.
  • Below—If the given X Val lies between two points in the LUT X set, the result is the LUT Data value that corresponds to the LUT X point whose value is less than the given X Val.

    For example, given LUT X is [0 1 5], LUT Data is [4 2 8], and X Val is 4, the LUT X value that lies directly below the given X Val is 1. The LUT Data value that corresponds to an LUT X value of 1 is 2. Therefore, the Result is 2.
  • Above—If the given X Val lies between two points in the LUT X set, the result is the LUT Data value that corresponds to the LUT X point whose value is greater than the given X Val.

    For example, given LUT X is [0 1 5], LUT Data is [4 2 8], and X Val is 4, the LUT X value that lies directly above the given X Val is 5. The LUT Data value that corresponds to an LUT X value of 5 is 8. Therefore, the Result is 8.
If you do not select Interpolate/Extrapolate for Method and the given value is out of range, this function returns the value of the end point that is closest to the given value.
LUT XSpecifies the set of x values that correspond to the y data points in LUT Data. The elements of LUT X must be monotonically increasing or equal such that LUT X[i] ≥ LUT X[j] if i > j.
LUT DataSpecifies a one-dimensional table of y data points that correspond to the values you specify for the LUT X parameter.

Block Diagram Inputs

ParameterDescription
MethodSpecifies the interpolation method the lookup table uses. You can choose from the following options:
  • Interpolate/Extrapolate—(Default) If the given X Val lies between two points in the LUT X set, the result is a linear interpolation of the LUT Data values that correspond to the two LUT X points. If the given X Val lies outside the range of the LUT X set, the result is a linear extrapolation of the LUT Data values that correspond to the nearest two LUT X points.

    For an interpolation example, given LUT X is [0 1 5], LUT Data is [4 2 8], and X Val is 4, the two LUT X values that are nearest to the given X Val are 1 and 5. These points represent the x coordinates of a set of points on a line. The LUT Data values that correspond to those LUT X values are 2 and 8, which represent the corresponding y coordinates of the points on the line. This function calculates the slope of the line as (8 – 2) / (5 – 1) = 1.5. This function then uses the slope to interpolate linearly the y value when x is 4. Therefore, the Result is 6.5.

    For an extrapolation example, given LUT X is [0 1 5], LUT Data is [4 2 8], and X Val is 6, the two LUT X values that are nearest to the given X Val are 1 and 5. These points represent the x coordinates of a set of points on a line. The LUT Data values that correspond to those LUT X values are 2 and 8, which represent the corresponding y coordinates of the points on the line. This function calculates the slope of the line as (8 – 2) / (5 – 1) = 1.5. This function then uses the slope to extrapolate linearly the y value when x is 6. Therefore, the Result is 9.5.
  • Interpolate—If the given X Val lies between two points in the LUT X set, the result is a linear interpolation of the LUT Data values that correspond to the two LUT X points. If the given X Val is out of range, the result is the LUT Data value that corresponds to the value of LUT X closest to X Val.
  • Nearest—If the given X Val lies between two points in the LUT X set, the result is the LUT Data value that corresponds to the LUT X point whose value is nearest to the given X Val.

    For example, given LUT X is [0 1 5], LUT Data is [4 2 8], and X Val is 4, the LUT X value that is nearest to the given X Val is 5. The LUT Data value that corresponds to an LUT X value of 5 is 8. Therefore, the Result is 8.
  • Below—If the given X Val lies between two points in the LUT X set, the result is the LUT Data value that corresponds to the LUT X point whose value is less than the given X Val.

    For example, given LUT X is [0 1 5], LUT Data is [4 2 8], and X Val is 4, the LUT X value that lies directly below the given X Val is 1. The LUT Data value that corresponds to an LUT X value of 1 is 2. Therefore, the Result is 2.
  • Above—If the given X Val lies between two points in the LUT X set, the result is the LUT Data value that corresponds to the LUT X point whose value is greater than the given X Val.

    For example, given LUT X is [0 1 5], LUT Data is [4 2 8], and X Val is 4, the LUT X value that lies directly above the given X Val is 5. The LUT Data value that corresponds to an LUT X value of 5 is 8. Therefore, the Result is 8.
If you do not select Interpolate/Extrapolate for Method and the given value is out of range, this function returns the value of the end point that is closest to the given value.
LUT XSpecifies the set of x values that correspond to the y data points in LUT Data. The elements of LUT X must be monotonically increasing or equal such that LUT X[i] ≥ LUT X[j] if i > j.
LUT DataSpecifies a one-dimensional table of y data points that correspond to the values you specify for the LUT X parameter.
X ValSpecifies the x value to locate in the LUT Data table.

Block Diagram Outputs

ParameterDescription
ResultReturns the y value in the LUT Data table that corresponds to the value you specify for the X Val parameter. If a direct match does not exist, this function operates according to the value you specify for the Method parameter.

Lookup Table 1D Details

Feedthrough Behavior

All input/output pairs of this function have direct feedthrough behavior.

Example

Refer to the SimEx LUT 1D VI in the labview\examples\Control and Simulation\Simulation\LUT directory for an example of using the Lookup Table 1D VI.


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit