LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Remove stored data in build array

Hi all,

          I'm going to try and explain my problem as best as I can. So I created a VI that asks the user to choose a file and stores the cotents of the file in an array. The array created has the dimensions of 102400xN, where N is 10 or 20 or 30 etc. Now I need to "chop the data up" as follows. I need to create a new array that contains every 1024 rows of data down first column until the end (of the column) and place each groups of 1024 data into new columns of the new array. Then move onto the next column. So basically the new array will have a dimension of 1024x(Nx100).

 

I've created an example to aid (hopefully) in the understanding what I'm trying to do, please see attached. The only thing is for the example replace 1024 (in the above description) with 3.

 

My problem is everytime I load a new file the previously generated new array would be stored and the new data (new file) would be added to the generated array but basically after the old data. Is there a way to clear the old data?

I am using build array to generate the new array.

 

 

Thanks.

0 Kudos
Message 1 of 5
(2,175 Views)

It would help if you posted your VI.

 

Are you keeping the new array in a shift register? If so, you need to initialize it each time you read a file.

 

With arrays that size, Build Array may cause memory allocation problems.  It is better to Initialize Array outside the loop to the final size (or larger) and inside the loop use Replace Array Subset.

 

Also look at Resize Array.  I do not think it will do what you want in one step, but you might be able to do things in "chunks."

 

Lynn

Message 2 of 5
(2,161 Views)

Basically what Lynn said.  I was just slower..... 

Message 3 of 5
(2,154 Views)

Thank you Lynn and Bryan for your quick responses. Lynn, your suggestion helped and is very much appreciated. I completely forgot about initializing the shift registers. Thanks, to both of you!

0 Kudos
Message 4 of 5
(2,133 Views)

Here is an example of what I was thinking when I mentioned Reshape Array.  With a 12x4 input array you can get output arrays with 1, 2, 3, 4, or 6 rows. It does not work correctly for 12 Rows in segment.  Other values will produce an error.

 

Lynn

0 Kudos
Message 5 of 5
(2,117 Views)