From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

dequeue problem

Solved!
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.

 

Strokes

0 Kudos
Message 1 of 3
(2,348 Views)
Solution
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.

 

Lynn

 

Queue problem.png

Message 2 of 3
(2,338 Views)

Top man, thanks much

 

Strokes

0 Kudos
Message 3 of 3
(2,333 Views)