LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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
(6,245 Views)
Solution
Accepted by AndreaD

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
(6,234 Views)

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

 

Clu.PNG

========================
=== Engineer Ambiguously ===
========================
Message 3 of 10
(6,226 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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 10
(6,221 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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 10
(6,217 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
(6,206 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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 10
(6,199 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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 8 of 10
(6,190 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
(6,183 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 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 10 of 10
(6,178 Views)