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.
Solved! Go to Solution.
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.