LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I pass an array by reference to a sub vi?

Hi,

My main LabView program loads an array with pictures. I then need to pass this array to different sub vi's.

So far I've been passing the array as an input parameter to the sub vi's.

I'm now experiencing memory shortage problems as I assume the picture data is being duplicated in each sub vi that receives it as a parameter.

So, I'm thinking it would use less memory if there was just one copy of the picture array in the main vi and then pass a reference to it as a parameter to the sub vi's.

Can I then use the reference in the sub vi's to display the pictures?

I can create a reference to the picture array in my main vi but what do I need to create in a sub vi to receive this reference as a parameter and then display the pictures?

Thanks,
Dave.
0 Kudos
Message 1 of 2
(3,471 Views)
Hi,

You need an object of the same type to be able to connect it via the sub-vi connector pane.
So, just right click the reference you created in the vi, choose create control and then copy this control to your sub-vi and connect it to the connector pane.
You can then access the elements of the array using properties in the application control pallette.

Hope this helps,
Paulo
0 Kudos
Message 2 of 2
(3,468 Views)