Showing results for 
Search instead for 
Did you mean: 

Decisions based on the data acquisition in Labview



how can make decisions in labview based the output of the data acquisition..


For example. if I have a voltage comming in from the light sensor...and lets say I want run the for loop this many times if the voltage comming out is greater than some threshold...any examples.



0 Kudos
Message 1 of 30
Have you looked at any of the comparison functions? What have you tried?
0 Kudos
Message 2 of 30

well, what I tried to is this:


I had DAQ assistant and from there I connected my graph to the output, and then I replaced that graph with an indicator...and I wired that indicator to the select VI and then hooked that to the for loop. So i said if the voltage in the indicator is above a threshold then output should be 5(the number of iterations for the loop) and when i ran the program, and the for loop did not iterate.



0 Kudos
Message 3 of 30

Sounds like a simple Case structure problem unless I am missing something. It would be easy to suggest if you have a snapshot of your VI or actual VI attached.




Kudos are (always) welcome for the good post. 🙂
0 Kudos
Message 4 of 30
You wired the output of the daq assistant to the select function? That does not make any sense. What are you using for a comparison and where did you write that? Its the output of a comparison that should be wired to the select. Attach your code or a snippet so someone can see what you have actually done.
0 Kudos
Message 5 of 30

well here is the thing


I have a DAQ assitant in the while Iam using a compare and select function to determine the number of the iteration of the for loop..

Now here is the problem... 


here is the program, the for loop does not iterate

0 Kudos
Message 6 of 30

1. What makes you think the for loop does not iterate?  If the Start Stop toggle switch is in the Stop position, the while loop inside the for loop will never end so the for loop will stay in its current iteration waiting for the while loop.  If the switch is true, then the for loop will run through its 10 or 20 iterations in 1 or 2 seconds.

2. It is usually better to create and start the task outside the loop, write the data inside the loop and then clear the task after the loop finishes.

3. Your indexing of the boolean array to write can be done very simply with the Quotient & Remainder function and a Subtract from 3 inside the false case of the CCLW/CLW structure.


Run your VI with Highlight Execution (the light bulb on the block diagram toolbar) turned on and watch what it does.


Here is a cleaned up version of your diagram showing the simplified indexing.





0 Kudos
Message 7 of 30

Try running your code with execution highlighting turned on (the light bulb icon in the toolbar) so you can see what your code is doing and the order in which your loops execute.  I can't figure out what you're trying to do with this code, but perhaps if you watch how it executes you'll have a better understanding of why it doesn't do what you expect.

0 Kudos
Message 8 of 30

I have tried that too, I mean with the start on in the for loop....but the the Value that comming out of the select VI does not output anthing. I clicked on start in the for loop... and I even placed an indicator at the output of the select, it stays 0...


I just dont know how to fix it.

0 Kudos
Message 9 of 30

Here is the thing I cant figure out, just dont know how to fix it..


whenever the graph indicator fromt he DAQ assitant is in the while loop it gives me the data and as soon as it is outside it gives me no data..




0 Kudos
Message 10 of 30