取消
显示结果 
搜索替代 
您的意思是: 

Enqueue array??

已解决!
转到解答

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

0 项奖励
1 条消息(共 10 条)
7,451 次查看
解答
接受人 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 项奖励
2 条消息(共 10 条)
7,440 次查看

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

 

Clu.PNG

========================
=== Engineer Ambiguously ===
========================
3 条消息(共 10 条)
7,432 次查看

@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 项奖励
4 条消息(共 10 条)
7,427 次查看

@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 项奖励
5 条消息(共 10 条)
7,423 次查看

@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 项奖励
6 条消息(共 10 条)
7,412 次查看

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
"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 项奖励
7 条消息(共 10 条)
7,405 次查看

@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 项奖励
8 条消息(共 10 条)
7,396 次查看

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.

9 条消息(共 10 条)
7,389 次查看

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
10 条消息(共 10 条)
7,384 次查看