LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Enqueue array??

Solved!
Go to solution

Is there a way I can complete an enqueue on a 1D array, instead of only one element? 

0 Kudos
Message 1 of 10
(1,718 Views)
Solution
Accepted by topic author AndreaD
08-26-2016 02:09 PM

Sure you can. You need to define the element data type as array.

https://zone.ni.com/reference/en-XX/help/371361H-01/glang/create_queue/

Thanks
uday
0 Kudos
Message 2 of 10
(1,707 Views)

Yes the Queue "data type" can be any data type, array, or even a cluster containing several different data types. 

 

Clu.PNG

-------------------------------------------------------------------
Unfortunately, most readers of this Forum, including some real Experts, have not mastered the skill of being able to read the code that Posters fail to post. If we cannot see "what you did wrong", we are unable to tell you how to fix it. (Bob Schor 28 August 2018)
Message 3 of 10
(1,699 Views)

@udka wrote:

Sure you can. You need to define the element data type as array.

https://zone.ni.com/reference/en-XX/help/371361H-01/glang/create_queue/


Yepper!

 

I cannot think of anything you can not transfer via a queue save a reference from one porcess context to another or across a network.

 

Ben

0 Kudos
Message 4 of 10
(1,694 Views)

@RTSLVU wrote:

Yes the Queue "data type" can be any data type, array, or even a cluster containing several different data types. 

 

Clu.PNG


I have even transfered clusters that contained queues via a queue.

 

Ben

0 Kudos
Message 5 of 10
(1,690 Views)

@AndreaD wrote:

Is there a way I can complete an enqueue on a 1D array, instead of only one element? 


The answers above are all correct, but I'm thinking there is a different way to interpret your question in which you have an array of elements, but want to cycle through and put each of them into the queue, where the queue is otherwise a scalar.  In that case, wrap your enqueue in a For Loop so it auto-indexes on the 1-D array.

0 Kudos
Message 6 of 10
(1,679 Views)

The other option is to use a FOR loop to dequeue multiple elements.  If I need to go this route, I typically have a timeout and stop the loop when there is a timeout.


There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
0 Kudos
Message 7 of 10
(1,672 Views)

@crossrulz wrote:

The other option is to use a FOR loop to dequeue multiple elements.  If I need to go this route, I typically have a timeout and stop the loop when there is a timeout.


Use a Preview Queue and wire the number of elements in the queue to the N terminal of the For loop. No TO required.

 

Ben

0 Kudos
Message 8 of 10
(1,663 Views)

Now you're talking the other direction where you are trying to dequeue an array of elements into a 1-D array from a queue of scalars.

 

In this case, instead of preview and dequeue, you might as well use Flush Queue.

Message 9 of 10
(1,656 Views)

Kudos for generating a "Sanity Check" User event in my head Bill.

 

I do have one reservation and that is "in-placeness". Provided we dequeue and do not branch wires the element removed from the queue is effective transfered "in-place". It is like the queue just trasfers the pointer from where it was queued to were is dequeued. But if we Flush, I wonder if the returned array is actuall an array of the same pointers or if the data gets copied to creat the array of returned elements. Something tell me that LV can keep track of thing and work inplace as long as we are connected to the queue operations but when we get an array back from the flush and pass that array to a sub-VI... Can LV keep track of those buffers?

 

Just thinking out loud.

 

Ben 

Message 10 of 10
(1,651 Views)