LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Not wiring of all non-updated fileds of a bundle as an input argument to a SubVI

Solved!
Go to solution

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

0 Kudos
Message 1 of 6
(2,733 Views)

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

Message Edited by Ben on 01-16-2009 10:47 AM
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 6
(2,731 Views)

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

0 Kudos
Message 3 of 6
(2,705 Views)

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.

 

0 Kudos
Message 4 of 6
(2,700 Views)
Solution
Accepted by topic author Af_Dk

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?

Message Edited by Dennis Knutson on 01-17-2009 01:50 PM
Message 5 of 6
(2,694 Views)

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.

0 Kudos
Message 6 of 6
(2,674 Views)