Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
5 ratings:
 3.39 out of 5   

Why Does Flush Queue Return a Cluster Array When My Queue Type is an Array?



Primary Software:
Primary Software Version: 7.1
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
I am using a queue in LabVIEW. I set its type to be an array of single precision numbers. When I call the Flush Queue VI, it returns an array of clusters. The cluster contains one element that is an array of single precision numbers. Why doesn't this return as a 2-Dimensional array?

Solution:
Flush Queue cannot return a 2-D array since each element in the queue could be an array of a different length. For instance, suppose the queue held two arrays, [1,2,3] and [4,5]. If these were combined into a 2-D array, the matrix would be [[1,2,3] , [4,5,0]]. Notice that the second row was forced to add an element of 0 since 2-D arrays must have an equal number of elements in each row and in each column. By using an array of clusters, each array can have different number of elements. To access the elements, first index the cluster array, and then use the Unbundle VI to access the individual arrays.

Related Links:
KnowledgeBase DIRECT-3S8RDE: What is a Queue?
Developer Zone Example: Queue to Pass Data

Attachments:





Report Date: 04/21/2004
Last Updated: 05/07/2008
Document ID: 38KGDEV3

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit