Contents - Index


LOOKUPCOL and LOOKUPCOL1

 

The LookupCol function scans a specified row in a table of tabular data and returns the column in this table in which the value is equal to a specified value.  A bisection method is used in finding the column, using all of the columns of data in the specified row.  The LookupCol1 function operates exactly in the same manner except that it does not use data in the first column.  The LookupCol1 function is used to provide two-dimensional interpolation of a Lookup table where the first row and first column provide the independent variables. See the Interpolate2DM function for an example. 

 

The LookupCol and LookupCol1 require three arguments.  The first argument is a (case-insensitive) string constant or string variable that provides the name of the Lookup table in the Lookup Window or the name of an existing stored Lookup file. The string constant must be enclosed within single quote marks.  Lookup table names appear on the tabs at the top of the Lookup Table Window.  EES recognizes both binary and ASCII forms for Lookup files, identified by the file name extensions of .LKT, .CSV, .TXT, .DAT, and .XLSX.  See Lookup File Formats for additional information.

 

The next arguments are the row in the table and a target value.  The function will return the column corresponding to the target value.  The column value returned will not necessarily be an integer.  Interpolation between columns will be provided as needed.  Note that the data in the specified row of the table must be monotonic, i.e., increasing or decreasing.  The LookupCol function will fail to find a correct result if this is not the case.  

 

The purpose of the LookupCol function is to provide a means of relating tabular information in different rows of specified Lookup Tables. For example, suppose temperatures are entered in row 1 of the Lookup Table named 'data' and the viscosity at each temperature is entered in row 2.  The column corresponding to a temperature of 100 will be returned with LookupCol('data' 1,100). The viscosity corresponding to that temperature is then Lookup('data',2,LookupCol(1,100)).

 

(Note:  use a semicolon instead of a comma as the list separator when using the European numerical format).

 

 

Example: 

 

X=lookupcol('Lookup 1',2, 35.7) {locate the column in row 2 of table Lookup 1 that has a value of 35.7, interpolating as needed}

 

See also:   

 LOOKUP    

 LOOKUPROW

 INTERPOLATE  

 INTERPOLATE1  

 INTERPOLATE2

 LOOKUP$    

 LOOKUP$ROW

 LOOKUPCOLNAME$

 Mathematical functions