LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

rebuild 2D array

Please help me to trouble shoot this programm. I want to transfer row 1, 2, 3 to the new array but some data were missing.
 
Thanks.
0 Kudos
Message 1 of 6
(3,109 Views)
You can use an Array Subset to isolate the first three rows (or any other chunk that you want) of the array.

Message Edited by tuned99 on 09-02-2005 02:38 PM

Download All
0 Kudos
Message 2 of 6
(3,099 Views)

Sorry, I no longer have LabVIEW 6.1 installed, but your program does exactly what you tell it to do. 😉

 

Here's how to fix it so it does what you want:

RIght-click on the input tunnel of the 2D array and "disable indexing".

Replace the "array subset" node with "Index array". Connect the blue wire to the upper index.

(Of course, if the three indices are consecutive, you could just use array subset on the 2D array directly, skipping the second loop.)

 

Message Edited by altenbach on 09-02-2005 12:38 PM

0 Kudos
Message 3 of 6
(3,099 Views)

Here's what is happening in your example inside the second loop:

The 2D (orange) and the 1D array (blue) are set to autoindex. The 1D array is shorter and thus determines that the loop will run 3 times.

  1. Iteration: You get row #0 of the 2D array. The subset operation keeps element 1...9.
  2. Iteration: You get row #1 of the 2D array. The subset operation keeps element 2...9.
  3. Iteration: You get row #2 of the 2D array. The subset operation keeps element 3...9

The output tunnel forms again a 2D array. Since some of the 2D arrays are short, they get padded with zeroes. The final 3x9 array will look as follows:

row #0: elements 1-9 of original row 0
row #1: elements 2-9 of original array, padded with one zero at the end.
row #2: elelments 3-9 of original array, padded with two zeroes at the end.

All clear? 😉

Message 4 of 6
(3,091 Views)
When the row indexes are consecutive, it's easier to use the "delete from array" or the "array subset" functions. Nevertheless, a loop can be usefull if you need to work with  independant indexes. The attached vi presents the 3 solutions.
Chilly Charly    (aka CC)
0 Kudos
Message 5 of 6
(3,091 Views)
Thanks everybody! It works.Smiley Very Happy
0 Kudos
Message 6 of 6
(3,081 Views)