Jump to content

Queue elements in 2D array form


Recommended Posts

I am trying to enqueue numeric data into 2D array form. The element data type and each enqueue element is a 1D array of numeric. When I read Elements in Get Queue Status, I see an array of cluster of 1D array! Is there a way to create a queue with elements organized in a 2D numeric array type

Thanks

Link to comment
I am trying to enqueue numeric data into 2D array form. The element data type and each enqueue element is a 1D array of numeric. When I read Elements in Get Queue Status, I see an array of cluster of 1D array! Is there a way to create a queue with elements organized in a 2D numeric array type

Only by building your own when you dequeue. LV does not support a 2D array where each row is a different length. There's no guarantee that the arrays that you have enqueued are all the same length, so there's a cluster level added when you do the Status so that you can have an array of arrays instead of a 2D array.

Link to comment
Only by building your own when you dequeue. LV does not support a 2D array where each row is a different length. There's no guarantee that the arrays that you have enqueued are all the same length, so there's a cluster level added when you do the Status so that you can have an array of arrays instead of a 2D array.

Many thanks for the reply. Indeed my 1D array elements are all of the same length but I understand your point. I need to read more than one element in the queue without removing them. Is there a simple way to do it apart unqueue and queue these elements back again.

Regards,

Link to comment
Many thanks for the reply. Indeed my 1D array elements are all of the same length but I understand your point. I need to read more than one element in the queue without removing them. Is there a simple way to do it apart unqueue and queue these elements back again.

In Jim's recent book, LabVIEW for Everyone (http://labviewforeveryone.com/), he provides an example of how to build your own queue using a functional global SubVI. This might be the best way to do what you want, but it's not necessarily simple unless you have experience with functional, i.e. LV2, globals. As I recall, the example is given in the appendix on graphical object-oriented programming (GOOP).

Link to comment
In Jim's recent book, LabVIEW for Everyone (http://labviewforeveryone.com/), he provides an example of how to build your own queue using a functional global SubVI. This might be the best way to do what you want, but it's not necessarily simple unless you have experience with functional, i.e. LV2, globals. As I recall, the example is given in the appendix on graphical object-oriented programming (GOOP).

Thanks for your suggestion. I have this book and the proposed Functionnal Queue.vi example looks as a good solution

Regards,

Link to comment
  • 12 years later...

@Yassamina BERKANE

The answer is the same as it was in 2006: dequeue and concatenate. A ragged 2D array is not (and never will be) meaningful in LabVIEW. Because the compiler cannot guarantee that you're going to add arrays of all the same size to the queue (you might be doing that, but it cannot be proven from code because refnums can be shared all over the place), any attempt to ask for all the queue elements in one array will have them each wrapped in a cluster. If you dequeue and concatenate, you can build a 2D array yourself. 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.