LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Container for multiple different length arrays

Solved!
Go to solution

Hey,

I'm in the process of making a Connected Component Labelling algorithm within LabVIEW.  I have come across the issue that I need a sort of data structure I can't seem to create.  I'm hoping I've missed something and someone can point it out to me.

 

What I'm looking for is a container that will hold lists of lists of 2 values.  Basically, I will have multiple labels.  Each label will have a list of coordinates in.  The closest I have come to creating this is a 2D array of clusters.  The cluster then contains the X and Y coordinates.  The problem with this is that each list is not the same size, and for a 2D array in labVIEW, all the rows/columns must be the same length.

 

In summary, I'm looking for a way to store several lists of coordinates.  The lists will all be different lengths, and I don't know how many lists there will be.

Is there any way to do this?

 

Alternatively, does anyone know an easier way than this to search a 2D array for concentrations of the same number?  In the back of my mind I want to say there maybe be an NI Vision VI which can do this, but I can't find one.

 

Thanks for all your help,

Dominic Walker

0 Kudos
Message 1 of 4
(4,409 Views)

This is more of a question to more experienced people than an answer, but instead of grouping arrays of clusters (or cluster of clusters?), could you use a functional global to store/retrieve the data. It might allow you to create extra lists on the fly and index them appropriately?

 

Ian

 

EDIT: PS As for concentrations of the same number, maybe you could differentiate the data and then look for regions where the rate of change is low or zero, indicating similar/identical numbers.

0 Kudos
Message 2 of 4
(4,404 Views)
Solution
Accepted by topic author D.M.Walker

One way of handling multiple arrays of different lengths (but all the same datatype) is to put the arrays into a queue.  Each element enqueued must be an array but they can be of different lengths.  To get at all the arrays you use the Preview Queue function.  It returns an array of clusters with each of the enqueued arrays in a separate cluster (if I recall correctly).   Maybe an array of clusters of arrays would work for you.  I just verified that this allows arrays of different lengths.  You could also put a string control with the label in the cluster if that is appropriate.

 

Lynn

Message 3 of 4
(4,385 Views)

Both these suggestions are great.  I had tried functional globals but I think I tried to over complicate things and ended up confusing myself and not getting it to work.

 

Queues sound excellent; the idea never crossed my mind but it should be simple and effective.  Thanks for the suggestions guys!

 

Regards,

Dominic Walker

0 Kudos
Message 4 of 4
(4,355 Views)