DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

MATCH and INDEX functions

Hello All,

             I'm trying to convert an existing Excel spreadsheet into DIAdem. I use several functions defined in office like the MATCH and INDEX functions. I could not find similar functions in DIAdem. It would be time-consuming to write an equivalent VBScript for these functions. 

Do we have similar functions in DIAdem ? 

syntax :

MATCH(lookup_value,lookup_array,match_type)

Returns the relative position of an item in an array that matches a specified value in a specified order. Use MATCH instead of one of the LOOKUP functions when you need the position of an item in a range instead of the item itself.

INDEX(array,row_num,column_num)

 Returns the value of an element in a table or an array, selected by the row and column number indexes.

Thanks

Vamshi

 

0 Kudos
Message 1 of 2
(4,126 Views)

Vamshi,

 

For the MATCH function you may want to take a look at the PNo or the ChnFind function:

 

Function: PNo

Determines the row in a numeric channel or a text channel, of which the contents are closest to a specified value or text.
ReturnValue = PNo(ChannelName,Value)
Input Parameters
ChannelNameSpecifies a channel name.
alueSpecifies the value or text to search for.

Return Parameters



ReturnValueReturns the number of the first row with contents that are closest to the
specified value or text.

 



Command: ChnFind

Determines the first row in a data channel that meets a specified condition. The ChnFind function searches a data channel from the beginning to the end.
ReturnValue = ChnFind(FormulaTxt, [ChnFindStartIdx])

Input Parameters

FormulTxt Specifies a formula in a script. Enter the formula in quotation marks. You must enclose texts that are in quotation marks, such as channel names, in double quotation marks.
[ChnFindStartIdx]
Specifies the line number at which DIAdem begins checking the data channel for a condition. By default DIAdem checks the data channel in the command ChnFind from the first row and in the command ChnFindReverse from the last row.

Return Parameters


ReturnValueThe return value is an Integer type. Returns the first line number that satisfies the given condition. If no row of the data channel meets the condition, the ChnFind command returns the result 0. If the ChnFindStartIdx variable is longer than the channel, the ChnFind command returns the result 0

 

 

 

For the INDEX function you can use the ChDX(row, Ch_index) variable. You specify the row (or index) in the channel you want to retreive the value from, and then the Ch_index or the number of the channel you want to get the value from.  Ex:

 

Dim MyValue

MyValue = CHDX(3,2)

Message Edited by herosphro on 06-08-2010 05:01 PM
John B.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(4,107 Views)