I want to control the flow of data, by a SWITCH.
I have a data flow which I want it to flow through a particular code, when I press that SWITCH, the data flow should be blocked and the code should use the previous values stored to calulate further.
Is there any such switch available in LabVIEW, so control the flow.
Like Ravens said, you'll definitely want to use a case structure. You will also want to use another widely used function in LabVIEW: shift registers. This is what will "store" your data from previous iterations.
I made a quick little VI to show you what we mean:
You will notice when the switch is pressed, you will see the iteration count go up, when it is false, the iteration count will stay the same, until the user hits the switch again.
There is also the "Select" operator in the comparisons pallette. I really like that one because it makes for a cleaner looking diagram, but one must always keep in mind that the Select operator will perform both operations leading to the "t" and "f" terminals where as the case structor is better at only executing necessary code.
As Ravans Fan pointed out, you would probably learn more faster by going through the LabVIEW tutorials. Case Structures and Select operators are fundamental to LabVIEW and are covered in the tutorials.
Thank You all for the replies
I have tried CASE structure, but what I am trying to do, I am not able to do it using using CASE.
Let me explain again.
I an sending continous data to a part of the code. What I need to do is make something (Switch/Button), that when I press the button, it should hold the value at that time and then continue the calculation with of the code with that stored value.
When I use case, When the condition is true it sends the value, but then when I make it false it does not stop and hold the value.
I hope I have explained it properly.
It's just a matter of using the case structure properly with the shift registers.
It would be easiest if you post what you have so far as a .vi so that we can see where you may be going wrong.
Did you look at the example I attached for you?
It counts the iterations, when you hit the "switch" again, it will keep the same value. (you can do calculations off of this value then) After you are done, hitting the switch again will go back to increasing the iteration count.