LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Iterate cluste of LV objects

Is it a correct way to iterate cluster of LV objects?

All objects inherite from Parent class. DD method is invoked inside iteration loop. 

Any problems concerning this way? 
And what about performance?


*** LV2018 ***
0 Kudos
Message 1 of 4
(2,168 Views)

You "iterate" (perform repeated, implicitly doing the same thing to the same, or similar item) over Arrays, which contain identical items.  Clusters are designed for grouping different items -- you unbundle a Cluster and explicitly treat each of their elements.  The idea is that you know the elements are different (but related to each other), so you write different routines to deal with each element.  For an Array, you would have the same routine to deal with each Array element (since they are all the same type).

 

By unbundling and having code (which can run in parallel!) for each Cluster Element, you are working at maximum efficiency.

 

Bob Schor

0 Kudos
Message 2 of 4
(2,156 Views)

@petrnowak wrote:

Any problems concerning this way? 
And what about performance?


Value property nodes are SLOW.  So that is a major downfall.

 

What I see here is a clearly bad data management.  If you need to iterate over objects, you should be using an array.  Arrays are also expandable, meaning you can easily expand your application simply by adding more elements to the array.


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
0 Kudos
Message 3 of 4
(2,146 Views)

I do know difference cluster/array of course. However, I have a cluster of LV objects all of them inheriting from the same parent. This way we can consider cluster of objects like array and call the "same" DD method in a loop. Its possible to convert cluster to array and iterate but I want to keep unbundle/bundle cluster feature to access individual item in cluster and call some other (e.g. static methods, that are not the same for all children).

I want to iterate all objects in cluster to avoid to construct unbundle-call method-bundle network because with hundreds of objects its a cumbersome programmer work...

 

I ask another way: dont talk about cluster/array difference. Do my method have any problems other than efficiency (slow property node call) ???


*** LV2018 ***
0 Kudos
Message 4 of 4
(2,137 Views)