01-16-2009 10:43 AM
Hi
I have a big bundle of data which I use to communicate between my SubVIs, each SubVI manipulates some of fields of this bundle and should send out the updated bundel.
Let say that my Bundel has 20 fields and in one of the SubVIs only 2 of those fields are updated and all the rest will keep the current values. At the end when the SubVI sends out the updated bundle, it needs to bundel both updated and non-updated fields together.
Wiring of all those non-updated fields to the output makes a mess in SubVI and needs a lot of wiring which is not so smart! using a local variable also needs an extra unbundeling and rebundeling.
I was wondering if there is any smart way of handeling this issue without so much wiring.
Regards
Afshin
Solved! Go to Solution.
01-16-2009 10:46 AM - edited 01-16-2009 10:47 AM
I'd suggest using a "Bundle by Name" in conjunction with type-def'd cluster. The "Bundle by Name" lets you pick and choose which values in the cluster get updaed. If you are not familiar with Type Definitions, this Nugget may help.
I hope that helps,
Ben
01-17-2009 02:08 PM
Dear Ben
Thank you for sending this information for me which was very instructive but I am afraid if it is not helping my case or at least I could not figure it out how it can be.
I already defined a type for my data cluster but when I pass it inside a subVI I want to change some of its fields while some others will keep the current values finally the updated cluster should be sent out by the subVI to be used by other subVIs, I just don't want to wire all those non-updated fields from input cluster to the output one (Within the subVI) becuae it makes it very messy.
Imagin a stucture in C that you just pass the pointer to a function and this function just manipulated some of its field but not all.
Thak you again for your information.
Regards
Afshin
01-17-2009 02:31 PM
Do this,
1) create the cluster in your m ain VI and shoot it into you subvi.
2) inside the subvi, use the "unbundle cluster" and about 2cm from the right of that use the "bundle cluster"
3) shoot all the wires that are unchanged from the "unbundle" to the "bundle"
4) connect the wires from the functions to the variable you want to change.
you can unbundle it a couple of times in the subvi and only use the terminals you want to use, at that location.
01-17-2009 02:49 PM - edited 01-17-2009 02:50 PM
A picture is worth a thousand words they say.
Zinnium,
As Ben mentioned, the best way to do this is with the Bundle By Name. Why use the Unbundle/Bundle and all of those wires?
01-17-2009 08:29 PM
I wasn't disagreeing with him. The simple bundle and unbundle is normally easier to explain and to use for a novice. they like it since you can see that the terminals match up.
The named bundle and unbundle for some reason takes them a little getting use to. I don't know why.