LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

passing data to subvi

I need to pass data to a subvi which has while loop inside. And the data need to be seen in while loop. How can it implemented?
Thx.
0 Kudos
Message 1 of 8
(4,046 Views)
You can use a reference to the indicator on the main VI. The attached examples demonstrates what I mean. If you go to the on-line help and look up control references, you get information on how to create subVIs that use them.
Download All
0 Kudos
Message 2 of 8
(4,047 Views)
Global variable is another way to do it.

Joe
0 Kudos
Message 3 of 8
(4,046 Views)
Hello,

The two previous posts are excellent solutions for your desired action.

One thing to note, however, is that the use of local or global variables can cause performance issues on a large scale. Every instance of one of these variables will create a copy of the data in memory. If you are trying to optimize your VI performance, you may want to avoid using these two variable types and stick to standard read and write dataflow operations.

I hope everything works out for you. Have a great day!

Kind Regards,

Joe Des Rosier
National Instruments
0 Kudos
Message 4 of 8
(4,046 Views)
How about using a queue?
0 Kudos
Message 5 of 8
(4,046 Views)
Thanks everyone for your answers. I am using reference to do this and it works fine.

Thx again.
0 Kudos
Message 6 of 8
(4,046 Views)

Dennis,

I have a Multicolumn listbox from which the user can select items to populate an 1D array. The user hits the "select" button after selecting desired items. I was wondering if there is a simple way to get this array into a sub vi that would pop up when the user hits select button(on the main vi)

 

Thanks

SH

0 Kudos
Message 7 of 8
(3,858 Views)
SH,
 
You can just used shared variables to do this.  Your main VI could write the array to a shared variable and your subvi could read these values from the same variable.  To learn more about shared variables you can read the following tutorial.
 
 
Also, in the future you might want to create a new thread for things like this.  The thread you replied to has not been replied to in 2 years so not many people are going to read your post.
 
-Justin D
0 Kudos
Message 8 of 8
(3,838 Views)