02-27-2013 08:04 PM
02-27-2013 10:07 PM - edited 02-27-2013 10:10 PM
Hello JKSH,
Branching array wires leaves the possible of LabVIEW creating data copies, so if possible, I would avoid it. You can use the "Buffer Allocation"tool to confirm that a data copy will or will not occur.
However, in the example you have shown, the code on the right of the time structured is unreachable since the timed structure will never exit ("False" is hard wired to the conditional terminal).
In addition, the array that is passed into the "For Loop" inside the Time structure, I'm pretty sure you're going to want change the tunnels to shift registers. Otherwise, the only thing that is going to come out of that "for loop" is an array full of 0's except for the last element will be populated with the value from the shared variable. (Maybe that's what you want but then why use a For loop to read all the elements
02-27-2013
10:50 PM
- last edited on
04-02-2025
05:18 PM
by
Content Cleaner
@gt8860a wrote:
Hello JKSH,
Branching array wires leaves the possible of LabVIEW creating data copies, so if possible, I would avoid it. You can use the "Buffer Allocation"tool to confirm that a data copy will or will not occur.
Thanks for the tips, gt8860a!
With the specific example in my original post, if I use the pass-through wire from the Read Variable VI, would it cause the inner for-loop to rewrite the output array (of variable references) at every iteration of the outer timed loop?
@gt8860a wrote:
However, in the example you have shown, the code on the right of the time structured is unreachable since the timed structure will never exit ("False" is hard wired to the conditional terminal).
In addition, the array that is passed into the "For Loop" inside the Time structure, I'm pretty sure you're going to want change the tunnels to shift registers. Otherwise, the only thing that is going to come out of that "for loop" is an array full of 0's except for the last element will be populated with the value from the shared variable. (Maybe that's what you want but then why use a For loop to read all the elements
Good catch; I didn't notice those. The example was from official NI documentation:
http://zone.ni.com/reference/en-XX/help/371361G-01/lvconcepts/switchtoprogsvaccess/
http://zone.ni.com/reference/en-XX/help/371361G-01/lvconcepts/usingdynvarapi/
How do we get them corrected?
02-27-2013 11:30 PM
Hello JKSH,
I believe if you passed the reference out to the border of the inner for loop and enable Indexing, it will recreate the output array on every iteration.
You could try this if you don't want to recreate the array every iteration.
As for correcting the example, I have no idea how to get that done. Maybe a moderator will read this thread and take the intiative.