04-30-2014 01:12 PM - edited 04-30-2014 01:15 PM
I have a large complicated cluster, and a very large array, that are accessed by nearly every VI/SubVI in my project. I do NOT want to wire them in and out of each routine; I'd prefer them to be globals.
I can avoid copying the data every time it's accessed in a SubVI by creating a Data Value Reference (DVR) for each. I can make the DVRs global; each SubVI that requires access to the cluster or array can use the global DVR to access the data, wiring the global DVR to an an in-place element.
Here's my question: Does it matter where the data itself (the cluster and the array) exist? My instinct would be to place them in the top-level main VI, which also creates the DVRs (and destroys them prior to exit). But the cluster and array could be globals themself. Is there any reason or benefit to doing that (make them globals as well as the DVRs that point to them)?
(A note: netiher of the data structures I'm discussing appear on the user interface...)
Thanks guys....
04-30-2014 01:20 PM
You don't put the data anywhere. They are contained in the DVR. The only issue would be when you actually create the DVR.
04-30-2014 02:11 PM
But the cluster and array could be globals themself. Is there any reason or benefit to doing that
Not that I can see. a DVR to a Global would still require you to read the global to operate on the data. Poof! that just forced a data copy. exactly what you tried to prevent by creating the DVR to pass around.