07-17-2015 10:18 AM
@Intaris wrote:
...when the elements in the cluster (which may have an origin beyond your control) has NO NAMES.
Or even worse, if multiple cluster elements have the same name. 😮
07-17-2015 10:40 AM
Oh good one, and you reminded me another possible usage of the unbundle. When there is over ever going to be one element EVER, and it is unnamed.
I've seen something like this done before, which allows for an array of an array without forcing all dimensions to have the same number of rows and columns.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
07-17-2015 10:52 AM
Array of clusters of arrays also allow for the data to be stored in non-contiguous memory blocks so even if they ARE all the same length, LV can allocate memory much differently.
07-17-2015 12:14 PM
@Hooovahh wrote:
I've seen something like this done before, which allows for an array of an array without forcing all dimensions to have the same number of rows and columns.
Here's a Darren's Nugget where I talk about using this trick to implement arrays of arrays.
07-17-2015 01:15 PM
@PaulG. wrote:
I challenge anyone to give me an example where bundle and unbundle is better than bundle and unbundle by name.
Two idioms immediately come to mind:
1) The "burner" cluster used as a temporary manner of reordering elements in an array of objects/clusters in order to use `Sort 1D Array` on a sort other than the native cluster order
2) Fanning-out into a corresponding fan-in pane:
Other common uses include:
I would defend using unnamed/anonymous syntax in cases such as this when:
For the same reasons, I'll often intentionally not typedef cluster types, even those that cross subVI boundaries, for the explicit reason that it's desirable to break a diagram if the data structure mutates -- when scope is contained, and defensive programming is desirable.
(On the other hand -- I argue that Call Library Function Nodes and Property Nodes should *never* have "No Names"! Since, an anonymous parameter into a black box is not visually debuggable.)
07-20-2015 05:36 AM - edited 07-20-2015 05:37 AM
@JackDunaway wrote:
1) The "burner" cluster used as a temporary manner of reordering elements in an array of objects/clusters in order to use `Sort 1D Array` on a sort other than the native cluster order
Awuuuuuuuh? This solves an age old problem that I've always been annnoyed that LabVIEW couldn't do elegantly. Sorting on some sort of "fitness function" (to borrow from GAs) or another value. Turns out I was wrong and it was cleverly hidden. Well I learned my new thing rather early today. Thank you.
07-20-2015 07:07 AM
@JW-JnJ wrote:
Awuuuuuuuh? This solves an age old problem that I've always been annnoyed that LabVIEW couldn't do elegantly.
Oh yeah OpenG array tools use this technique for the sorting but keep the sorted pointers. This is obviously handy if you have to arrays that are linked some how, and rearranging one by sorting, means you should reorder another array in the same way (OpenG also has the reorder array function).
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
07-20-2015 07:57 AM
@Hooovahh wrote:
@JW-JnJ wrote:Awuuuuuuuh? This solves an age old problem that I've always been annnoyed that LabVIEW couldn't do elegantly.
Oh yeah OpenG array tools use this technique for the sorting but keep the sorted pointers. This is obviously handy if you have to arrays that are linked some how, and rearranging one by sorting, means you should reorder another array in the same way (OpenG also has the reorder array function).
Pardon my challenging on a topic I just learned about this morning.
Wouldn't it be better to just bundle all of the objects you want sorted in with the initial cluster?
(asking because if I'm wrong, there is a VERY good answer in there)
07-20-2015 08:11 AM
I have had many situations, especially with lookup tables, where it was better to have seperate arrays than to have an array of clusters.
Also, you have to be very careful with the sort. It sorts on the first item in the cluster first. So you have to make sure your cluster is in the order you want it to be in.
07-20-2015 08:17 AM
@crossrulz wrote:
I have had many situations, especially with lookup tables, where it was better to have seperate arrays than to have an array of clusters.
Ahh, so more of an architecture driven choice than a computation one. Makes sense.
Speaking of which, it seems there is negligable computation difference after I ran both through a timing test.