Showing results for 
Search instead for 
Did you mean: 

dequeue problem

Go to solution

I wish to populate an array with data recevied from the dequeue operation. Here's what's happening at the minute... Connecting the build array function to the dequeued element rewrites the array for every dequeue operation leaving me with an array of 1 element i.e. the last element dequeued.


To attempt solve this problem, I used the insert into array function with the hope of building an array with each dequeued element as elements of the array. See attached vi.. However, I'm still getting an array with just 1 element, which is again the last element dequeued.


I'm sure i'm making a straight forward error but can't see where.



0 Kudos
Message 1 of 3
Accepted by topic author Strokes

You are close.  The shift register needs to pass the output array back so that the next data can be appended.  The attached image shows two ways to do this.


Using Build Array (upper shift register) is very easy but will cause LV to allocate new memory for the output array frequently.  This can cause significant performance problems as the array grows.


By pre-allocating the array (lower shift register) and using Replace Array Subset the same memory space is used for the output array.  If the data sample array contains more than one element, the index needs to be adjusted by the number of elements added rather than the loop iteration count.




Queue problem.png

Message 2 of 3

Top man, thanks much



0 Kudos
Message 3 of 3