NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Searching 2D array for a passed parameter

Right now I have a passed 2D array of strings contains 4 rows and a varying number of columns (anywhere from 0-50 columns are possible depending upon number of devices present). I'm looking for the best way to search the 2D array for a passed parameter (serial number) and if the serial number is found in the first row of the array then it should return the rest of the rows for that particular column. If no match is found nothing needs to be done.

I'm struggling with properly searching 2D arrays in Teststand. Any help would be greatly appreciated.

0 Kudos
Message 1 of 3
(2,670 Views)

if you have labview, you could pass the array to labview and use the array functions that it has and pass it back to Teststand.

 

I just checked, and you could also try with FindIndex in TestStand

http://zone.ni.com/reference/en-XX/help/370052N-01/tsfundamentals/infotopics/findindex/

0 Kudos
Message 2 of 3
(2,634 Views)

I would suggest using the FindOffset function.  For example, 

 

Locals.DesiredCol=FindOffset(Locals.ArrayTest[0],"123",False)

 

returns the number of the column where "123" is found in the first row of ArrayTest (which is assumed to be a 2D string array)

From there, you can get the desired column with Locals.ArrayTest[0..3][Locals.DesiredCol] 

(I use 0 to 3 since you say you have 4 rows.)

 

Pulido Technologies LLC

0 Kudos
Message 3 of 3
(2,629 Views)