LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What is the best approach for passing large clusters?

Solved!
Go to solution

450 elements in a cluster? o.O You don't mean 450 rows/values? If it's only 1 cluster of 450 elements you can easily send it around in a shift register, but if it's an array of this so the data gets big you might want to go with a DVR instead.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 11 of 16
(1,049 Views)

@Blokk wrote:

I can use a cluster of clusters but I would end up with two many bundle/un-bundles to the get to my elements. 

 

Why? You can create a proper data hierarchy with descriptive names and sub-clusters! If you want to pick a subcluster, it takes only a single "Unbundle by Name"! Oh yes, and you MUST use Type defined cluster for your project, alongside with "Bundle/unbundle by names".

 

edit: and do not forget to make the subclusters also type defined. It will help you when you need to carry out modifications.


That's great Blokk, I had no idea.

 

But the comments made me think... Maybe using an array is better because I have corresponding elements that need to be selected for certain actions like comparison. And in clusters I have to select them by name individually because indexing is also not that easy. To be clear my output which needs to be dumped into a csv looks like the attached spreadsheet. In my final step I need to compare for example measurement-1 to lower limit-1 and upper limit-1 to determine Pass or fail-1, these all correspond together. I avoided the array solution because I didn't want to keep track of the labels. Now I am thinking maybe it's better to use a cluster of settings sub-cluster and four arrays for measurements, lower limit, upper limit and pass or fail. Any opinions?

0 Kudos
Message 12 of 16
(1,028 Views)

@crossrulz wrote:

I am with the others.  It sounds like you need to rethink your data structure.  And why do you even need that many parameters?  I have yet to run into a situation where I needed that many variables.  But a couple of options:

1. Use arrays.  Arrays of clusters also work well, depending on what you are doing.

2. Use Variant Attributes.  You can store all of your parameters in a single variant and use a string (name) for the lookup.  The lookup for a Variant Attribute is fast (everything is sorted as you add data).


Thanks for your input crossrulz.

I know variants are good for handling different data types but here I am handling everything as string. Could you point to an example on how I can use them here?

 

0 Kudos
Message 13 of 16
(1,023 Views)

So this is what I have come up with. The question now what is the most efficient data type to use: Most of my cluster elements can be single precision float along with a limited number of strings. Is it more memory efficient to keep everything in string format(since it uses a pointer) and convert when needed?

Message 14 of 16
(1,004 Views)

It definitely sounds like the array of clusters is what you really need.  It is a lot more expandable than the giant cluster.

 

As for your data, I would use a string.  You can either flatten the data to string or use the many string conversion functions.  If memory is the concern, then use Flatten To String and Unflatten From String as necessary.


GCentral
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
Message 15 of 16
(991 Views)
Solution
Accepted by topic author H7N

@H7N wrote:

So this is what I have come up with. The question now what is the most efficient data type to use: Most of my cluster elements can be single precision float along with a limited number of strings. Is it more memory efficient to keep everything in string format(since it uses a pointer) and convert when needed?


If you use a cluster (or clusters in array), you'd be using a pointer anyway. LV doesn't pump cluster data though the wires, but passes pointers. My guess is it doesn't matter at all if the elements inside are strings or singles. 

 

If they are floats, I see no reason to convert them from\to string. It's a waist of CPU, memory and programming effort.

 

What makes you worried about memory anyway? 450 stings in a cluster, even if you have that 100 times would not make me worried. Optimize when proven to be needed, not when you expect it to be needed.

Message 16 of 16
(978 Views)