LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to increment to next column in an array

hey

 

I have to store the values of a 1 D array into a 2 D array. This ,uxt happen continuously. The 1st column of the 1D array must be shifted to the 2nd column of the 2D array and so on.

 

For eg:  1D array                                         2D Array

                    2                                               -         2

                    1                                               -         1

                    9                                               -         9

 

Here the - is the 2nd set of elements from 1D array.

 

How should i solve this ?

 

Thanks in advance

0 Kudos
Message 1 of 2
(1,851 Views)

It helps to use precise terminology.  In LabVIEW, an Array and a Matrix are different data structures.

 

LabVIEW, like most other programming languages, uses what is called "row-major" ordering to store Arrays.  That is, if you build an Array out of two 1D arrays of the same length (using Build Array), you will get a 2-row, N-column array.

 

There are many ways to access this 2D array by columns,  One is to simply Index Array, specifying the column index. 

 

If you pass the Array through an Indexing Tunnel (if you studied the For loop, you should have seen Indexing tunnels, which look like a square box with [ ], a pair of brackets suggesting an Array, inside them), LabVIEW will peel off and present to the inside of the For loop elements indexed by the first subscript each time through the loop.  If it is a 2D array, that corresponds to working on the Array a Row at a time.  What if you want to work on it a Column at a time?  Do you know about "Transport 2D Array"?

 

Bob Schor

 

P.S. -- keep saying to yourself, "An Array is Not a Matrix", and its inverse, "A Matrix is Not an Array".

0 Kudos
Message 2 of 2
(1,832 Views)