LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I convert an array with varying length into a cluster

Hi,


I need to convert an array of n elements into a cluster. Usually, it only involves the "Array to Cluster" function. But since the array length is not constant and the number of elements in the function is constant and can not be changed programaticaly, I need to find another way to do that.


Any ideas?


Thanks.
0 Kudos
Message 1 of 6
(3,035 Views)
Hi,

I also tried to do this but without success. I think that's not possible.

For me it's a general problem using labview. I often wanted to generate standard controls dynamically which is not possible (or I haven't found the solution yet). So I think that's the reason why you can't create a cluster during runtime (the program would have to add controls dynamically to the cluster).

Do you have an upper limit for your array-size? Although it needs a lot more memory, it would be a possibility to create the cluster with the maximum number of elements.

If you don't have a maximum, you will have to look for another way, I'm afraid.

Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 6
(3,031 Views)
I had the same idea about having an upper limit but the problem is not only will it increase the memory space required but I also have to save the whole thing into a database and that would substantially increase the size of the database.
0 Kudos
Message 3 of 6
(3,029 Views)
Do you have more informations about what you want to do?

There may be another approach.
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 4 of 6
(3,023 Views)
You can't do what you're describing. A cluster with 4 elements is a different datatype than a cluster with 5 elements.

If you change the cluster size dynamically (inside a case sstatement for example), you will get broken wired when you try to connect them all to the same output tunnel "Connecting different datatypes to the same terminal).

It would be possible to use a cluster with a max number of elements (say 256), but this means a large amount of wasted memory when dealing with smaller Arrays.

Why do you absolutely need to change the array into a cluster?

Shane
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
Message 5 of 6
(3,016 Views)
I would also like to know "Why do you absolutely need to change the array into a cluster?"

Redfining a cluster at run time is like redefining a structure in C at run time.

The other short-coming I heard had to do with the user interface.

There are methods that can handle these challenges in MOST cases.

We need to know more before we start getting to complicated.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 6
(2,999 Views)