Showing results for 
Search instead for 
Did you mean: 

Creation of Switch


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.


Thank You

0 Kudos
Message 1 of 9

It sounds like you want to use a case structure which is one of the fundamental structures in LabVIEW.


I would recommend you learn more about LabVIEW from here. How to Learn LV

0 Kudos
Message 2 of 9

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.



Chris Van Horn
Applications Engineer
0 Kudos
Message 3 of 9

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.

0 Kudos
Message 4 of 9

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.


Thank You.

0 Kudos
Message 5 of 9

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.

0 Kudos
Message 6 of 9

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.

Chris Van Horn
Applications Engineer
0 Kudos
Message 7 of 9
I have LabVIEW 8.2 i guess the file that you attached is higher than that. But I will try it out.
0 Kudos
Message 8 of 9

Ahh, my fault. Here you go:


Chris Van Horn
Applications Engineer
0 Kudos
Message 9 of 9