09-08-2009 04:28 AM
This may have been posted before, but when a variable is wired straight through a for loop (queue references for example) and the loop iteration is set to zero, or there are no elements in an auto indexed array, the wire going straight through results in a null or zero value.
Solved! Go to Solution.
09-08-2009 04:35 AM
09-08-2009 04:40 AM
You always get the default value for that data type. There was a small discussion in one of Darrens nuggets (if I remember correctly).
Felix
09-08-2009 04:41 AM
This behavior is as old as LabVIEW's For Loop and it is no bug. It's simply how LV works.
Please note that there have been quite many KBs and similar around. The latest KB regarding this behavior can be found here.
hope this helps,
Norbert
09-08-2009 04:41 AM - edited 09-08-2009 04:43 AM
I suppose it's because tunnels are not 'paired' in the same way SRs are.
I can't believe I haven't come across this before 🙂
09-08-2009 04:43 AM
It is no "pair" when using shift registers (SR).
The SR is always the same memory location (left and right node) whereas tunnels are always seperate memory locations (aka as copy of value).
Norbert
09-08-2009 05:03 AM
Thanks, Norbert. I was under the impression that SRs were buffered as well.
11-28-2017 12:03 PM
> There was a small discussion in one of Darrens nuggets (if I remember correctly).
I didn't find it: https://forums.ni.com/t5/Community-Documents/Darren-s-Nuggets/ta-p/3524320.
Using a shift register is not always appropriate. Take an error wire for example; it is likely that as many of the for loop iterations should work as possible (e.g. read all calibration tables into memory). If one at the beginning fails the later ones should not. In this case, the error wire Tunnel Mode should be Indexing instead, and the zero N / no iterations scenario handled by routing the error wire around the loop and merging the array into it, sort of like this: https://forums.ni.com/t5/LabVIEW-Idea-Exchange/Add-Merge-Errors-on-Loop-Terminal/idi-p/3202506?light...