10-20-2006 07:49 PM
10-21-2006 12:20 AM
Sorry, maybe I didn' get you point... but why don't you just uses wires to pass the data from subVI1 to subVI2 ??
I want to use a subVI-1 to set a bunch of parameters which will be stored in some sort of variable. I then want to use those parameters in a different subVI-2 that will only read them (no writing).
....
I was thinking that I could put the controls in the mainVI and hide them from the UI, and then when subVI-1 is called, it has a duplicate of the controls in mainVI (maybe I could use a typedef and a custom control?? -- or maybe a property node??), when subVI-1 is finished, it will update the control in mainVI. then when subVI-2 is called, the updated controls can be passed to it from mainVI.
10-21-2006 01:15 AM
10-21-2006 08:09 AM
10-21-2006 08:14 AM
like nate said already, shift registers are a way to go. you use them basically as a buffer for the various runs of your subVI1/subVI2 sequences. see attachment for a possible simple solution
@zskillz wrote:
oops, sorry - thats not obvious- or maybe i'm overthinking it!... - because i want the parameters to be retained for the duration of mainVI in case subVI2 is used more than one time. (i.e.-the user repeats the experiment)
does that help?
-Z
10-21-2006 04:11 PM
10-22-2006 09:29 AM
ok, if you want to pass the data cluster into subVI2, you need a control of that type on the front panerl (FP) of sub2. Copy and paste is one option, but you can also define a cluster of this type as a new (custom) type in labview, this is called a type definition, or typedef in labview jargon. You might look in the manuals or the help system to find out how to deal with them. Typedefs are most useful if you use a specific custom type over and over in your program. But Copy and Paste is also fine to start with.
subVI1 creates a cluster full of controls. I then return this cluster to mainVI and stick it into a shift register...
I want to subVI2 to take that cluster as input. in the block diagram of subVI2, I want to unbundle the controls in the cluster and use them as inputs into a variety of other subSubVIs. The problem that I'm having is that I don't know how to get the control cluster into the block diagram of subVI2 so that I can do the stuff I just said I want to do. The only way that I can think of doing this is to copy the cluster from subVI1 and paste it into subVI2, then to just make it invisible on the front panel of subVI2, but this seems like a really kludgy way of doing this....
10-22-2006 11:56 PM - edited 10-22-2006 11:56 PM
well - I feel much better about the way I was doing it then. I did copy/paste, but I ended up just using a strict typedef of the cluster.
@alkazaa wrote:
ok, if you want to pass the data cluster into subVI2, you need a control of that type on the front panerl (FP) of sub2. Copy and paste is one option, but you can also define a cluster of this type as a new (custom) type in labview, this is called a type definition, or typedef in labview jargon. You might look in the manuals or the help system to find out how to deal with them. Typedefs are most useful if you use a specific custom type over and over in your program. But Copy and Paste is also fine to start with.
But there is no way around having a control of that type on the FP of sub2 when the data are passed in with wires. It is not kludgy but the regular way of doing things in labview. Is the front panel of sub2 open when it's running in your application? If not, there is no need to make the cluster invisible. Even if it is open, you might want to have it visible in order to check that corretc data are passed. But normally most subVIs are invisible during execution, they behave like any non-user-interface subroutine in any language.
If you have the FP open, you can also move the control outside the visible part of the window to make it invisible.
Within sub2 you then proceed by unbundling and feeding the components to the subsubs.
BTW, bundling just for the purpose of reducing the number of wires or FP controls is often not the best idea. The strcuture of the data should primarily be determined by the meaning of your data. So you might want to feed the data into sub2 by using various controls instead of grouping them in one big cluster. Of course there is some upper limit of what is preactical.Usually I prefer to have not more than 6...8 controls which I feed into a subVI.
Message Edited by zskillz on 10-22-2006 11:57 PM
Message Edited by zskillz on 10-22-2006 11:57 PM