LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

determine number of rows in 2-d array

I have a 2d array. How do I determine the number of rows? What if it were an n-d array? Thanks for any help anyone can offer.
0 Kudos
Message 1 of 3
(4,702 Views)
Hi:

Use the ARRAY SIZE primitive in the Array Pallete. For a 2-d array, the ARRAY SIZE function will return an array with 2 elements. The first element is the number of rows, the second is the number of columns. For any N-dimension array, you can place a front panel array control and play around with the dimensions of the array and see how the ARRAY SIZE function returns the results.

Have fun
Robert
Message 2 of 3
(4,702 Views)
Hello

The following excerpt from LabView's help seems to answer your question:
The vi called Array Size in the LV array palette should do this job:

Array can be an n-dimensional array of any type.
size(s) is a 32-bit integer if array is one-dimensional (1D). If array is multidimensional, the returned value is a 1D array in which each element is a 32-bit integer representing the number of elements in the corresponding dimension of array. For example, if you wire a 3D 2x5x3 array to array, the function returns a three-element array containing [2,5,3].
--------
In a 2D array the first number is the Row, the second number is the column. I think the best way is to experiment by writing a little LV code, where you build an array of constants and use the Array
Size vi to read its output and see what it puts out.

Happy G Coding
Khan Kabir
Xerox
Message 3 of 3
(4,702 Views)