LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Weird - Empy Array For Loop Clears Error!

Solved!
Go to solution

Hi,

 

Just wanted to share some slightly odd behaviour i found  - since it took me a while to work out what was happening in a buggy program because of this - basically if you wire an empty array to a for loop it doesn't execute.  BUT it doesn't even pass across data in this example errors (i guesss it doesn't know which wire goes to which whire)  - which could be a problem - it replaces it with the default value.

 

I've attached an example of it.

 

 

0 Kudos
Message 1 of 3
(2,367 Views)
Solution
Accepted by topic author wideofthemark

You'll probably find a hundred messages on this forum saying exactly the same thing - it must be one of the least obvious features of LabVIEW.  But yes, if the For Loop doesn't execute, the outputs get the default values.  The way to pass the error through the loop is to use a Shift Register - right-click on the loop and add one.  That passes the error (or any other value) across correctly.  You should always use Shift Registers for Errors!!

Message 2 of 3
(2,363 Views)

Ah. 

 

I guess i only really use shift registers for things i need inside the loop - hadn't thought about their effect in cases like this.  Will bear it in mind

 

Thanks anyway.

0 Kudos
Message 3 of 3
(2,359 Views)