NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Determine the Size of Each Dimension of a 2D Array in TestStand

Solved!
Go to solution

How do I determine the size of each dimension of a 2D array in TestStand?  myArray.GetNumElements() returns to TOTAL number of elements in the (2D) array and doesn't help me.  I need to iterate over only one dimension.

 

Thank you,

 

Andrew

 

0 Kudos
Message 1 of 6
(6,798 Views)

Look at GetDimensions, GetDimensionsSizes, GetUpperBounds, and GetLowerBounds and decide which suit your case best.

 

- James

 

0 Kudos
Message 2 of 6
(6,797 Views)

GetUpperBounds(int dimension) is exactly what I need.  Unfortunately, it doesn't seem to be present:

 

Error in call to TestStand API member 'PropertyObject.GetUpperBounds'.
Method 'GetUpperBounds' does not exist in interface 'PropertyObject'.

 

This is the result of code:  Locals.my2Darray.GetUpperBounds(0)

 

0 Kudos
Message 3 of 6
(6,793 Views)
P.S.  I am using TestStand 4.2
0 Kudos
Message 4 of 6
(6,791 Views)
Try Locals.My2dArray.Type.ArrayDimensions.GetUpperBounds()
0 Kudos
Message 5 of 6
(6,759 Views)
Solution
Accepted by awdeorio

GetUpperBounds exists but just not in that context. Try something like the following...

 

Locals.MyDimensions = Locals.MyArray.Type.ArrayDimensions.GetUpperBounds ()

 

Where Locals.MyArray is your 2-d array that you want the dimensions of and Locals.MyDimensions is a 1-d array to store the dimensions. Something like...

 

Locals.MyArray.Type.ArrayDimensions.GetUpperBounds()[0]

 

... would work as well, this example would return the number of elements in the first dimension of Locals.MyArray.

 

Regards,

 

Steven Zittrower

Applications Engineer

National Instruments

http://www.ni.com/support

Message 6 of 6
(6,757 Views)