London LabVIEW User Group

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Tip: Losing your numbers (and references!)

Ever lost your number or more realistically lost a reference when passing through a for loop? Like this…

Losing your numbers and references - a screenshot

This one is not obvious! If you are using a auto indexing array into a FOR loop, you may at some stage in your code be passing a zero element array into a FOR loop. This is treated like wiring a zero into the “number of loops” terminal, which, in effect, means the code inside the loop is never processed, but more importantly it means any outputs from the loop revert to their default values. For items that are required in the loop, the best way to get around this is to “shift register” the items into and out of the loop, then it doesn’t get lost!! This is especially important when passing references through loops as you don’t tend to think of these being altered in the loop, but beware that references may get “nulled” if an inadvertent empty array is passed into the loop.

Losing your numbers and references - follow up screenshot

Got a LabVIEW Tip of your own that you would like to share? Leave a message in the comments below or head over to our Facebook Page and leave us a message! If you would like to receive a new LabVIEW Tip each month directly to your inbox, follow this link to subscribe to our monthly newsletter!

The post LabVIEW Tip: Losing your numbers (and references!) appeared first on Austin Consultants.

0 Kudos
Message 1 of 1
(4,890 Views)