LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

for loop execution

Solved!
Go to solution

So this is an interesting behavior. I pulled this code out of a larger vi I am using. The two dimensional array appears to be empty, but the for loop that is auto-indexing on this array executes 106 times. Curious if anyone can duplicate this on their machine.

I am using LabVIEW 2014 on a Win7 OS.

0 Kudos
Message 1 of 6
(3,433 Views)

That is expected.

 

The control has a 100 X 0 array saved in it.

 

This will do the same thing.

 

Empty_array.png

 

The loop is indexing on the first index.

 

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 6
(3,403 Views)

@Ben wrote:

That is expected.

 

The control has a 100 X 0 array saved in it.

 

 

 


How can you tell?

0 Kudos
Message 3 of 6
(3,398 Views)

Watch it with the light bulb on.

 

Sit down, wrap your head with duct tape and check out this thread.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 6
(3,395 Views)

Whooa! Thanks for the link.

Not sure I would call this expected behavior. A for loop iterating on an empty array seems counter intuitive to me.

0 Kudos
Message 5 of 6
(3,387 Views)
Solution
Accepted by topic author p0rter2000

If you read that thread you will see that I was of the same opinion when I first encountered an empty array with a non-zero dimension.

 

Reader Digest summary....

 

Hidden in array wires are I32's that hold the size of the arrays. For loops use that dimension infor to control loop iteration counts. With an array of size "100 X 0 " the "100" controls how many time the For loop iterates.

 

Read that thread for more insight.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 6
(3,382 Views)