LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why isn't array data passing into my for loop

Solved!
Go to solution

Hello,

What would cause data to not pass into a for loop?? I am updating code for a third party DAQ (Model 2000) from QCM Research. I do not have access to the daq, so I am bypassing the DLL's and using the random number generator to send fake data via an array. I can see all data, before it passes into the for loops, using the probe or an indicator. What am I doing wrong?? Could the sequence structure be the problem?? I have attached a zip file that contains the project vi's, but my problem is occurring at the bottom of the Model_2000_System_Mon.vi Block Diagram. Any suggestion are welcomed. Thanks

loops.png

0 Kudos
Message 1 of 10
(3,893 Views)
Solution
Accepted by topic author mzlhb

My guess is array2 is empty.  Hard to tell with all the local variable abuse going on


"Should be" isn't "Is" -Jay
Message 2 of 10
(3,847 Views)

Yup I was going to say the same thing.  A For Loop will run the number of times specified, but if multiple things are telling the loop to run a different number of times, it runs the minimum.  In your case you are indexing multiple arrays telling the loop to run potentially different amount of times.  If one of those arrays is empty, then it won't run at all.  Just like if you wired a 0 to the N terminal.

0 Kudos
Message 3 of 10
(3,842 Views)

Thanks for your input, Jeff. The array isn't empty, because as mentioned .. I probed it, at the entrance to the for loop. I did not place the local variables. According to the engineers from QCM Research, this was written by someone from National Instruments. I am just trying to update it.

0 Kudos
Message 4 of 10
(3,840 Views)

Okay, thanks Hooovahh. My problem is that I have never had to write code, without the actual hardware for which I am writing the code. So I'm trying to figure out how to trick the software into thinking that it is connected to hardware. I did use a DAQmx simulation once, but this is not NI hardware. I will try something other than arrays. Thanks for your reply. Although it was similar to the last reply, you gave more details for me to better understand.

0 Kudos
Message 5 of 10
(3,834 Views)
Solution
Accepted by topic author mzlhb

Jeff/Hooovahh,

 

Array2 is empty in the second for loop and the timer array for the first loop ... thanks.

0 Kudos
Message 6 of 10
(3,828 Views)

Well, lets look some more

 

Channel Array is never written anywhere its terminal is hidden and not wired to anything so, when you get to the event Unit Config" Value Change you read the empty value and iterate the for loop inside thee model 2000 unit config sub vi 0 times then autoindex its empty array output to fill Array2 with an empty array (Look right above that write to Array 2 Local and... you see that terminal for Array2?  yup- you are also writing Array 2's terminal for every event and---- bingo its wired to nothing!


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 10
(3,827 Views)

Thanks, Jeff. I did notice that channel array is hidden, but I cannot find any property nodes that could be hiding it. Many things are hidden and I cannot unhide them.

0 Kudos
Message 8 of 10
(3,823 Views)

Right click the terminal show control, set it via the property browser


"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 10
(3,814 Views)

For the property browser, would I go to View>Class Browser?? How would I get to the property browser from there?? I have never used this feature. Thanks

0 Kudos
Message 10 of 10
(3,808 Views)