LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

is it possible to have an if statement in labview?

for example, i want to compare two results and based on the result, execute a command, how do i do this?
0 Kudos
Message 1 of 13
(3,887 Views)
yeah,
All this is easily possiable in Labview,why dont you go through the examples given along with LV it should give you a fair idea of what things are possiable with LV.
As about the question you asked you have to look into the comparision and structures pallet of the function pallet for your answers,its just that it would be better if you come up with a code that i dont want to put the code here for you.
any problems plz reply
cheers
vicky
0 Kudos
Message 2 of 13
(3,883 Views)

To elaborate some more, after checking for the value, you need to wire the result into the condition terminal of a case structure. Just like in a text based language, a case structure will execute only one of its cases based on the condition. You can wire many data types into the condition terminal.
To learn more, I suggest you read the LabVIEW user manual. Also, try searching this site and google for LabVIEW tutorials. Here is one you can start with. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide.


___________________
Try to take over the world!
0 Kudos
Message 3 of 13
(3,880 Views)
thanks a mil, i'll try those suggestions and hopefully will make some progress
0 Kudos
Message 4 of 13
(3,868 Views)
Here is a small example of how an "If" works in Labview.
- tbob

Inventor of the WORM Global
0 Kudos
Message 5 of 13
(3,844 Views)
Or, like this 🙂
0 Kudos
Message 6 of 13
(3,814 Views)
hey, that's brillinat, that's exactly what i'm looking for...i'm still having problems though! i'm taking an element from an array using the index array function, and i want to compare this value to an index value, however it won't let me wire this value to the select function, it allows me to wire it to a greater than function, btu then after that i can't wire it to anything else, i've attached the file, any help would be greatly appreciated. the start of the file just acquires waveform data from an accelerometer.
0 Kudos
Message 7 of 13
(3,792 Views)
Hello ru,

at least I removed the error...

Hope this helps,
GerdW
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 13
(3,784 Views)
that helps, thanks a mil
0 Kudos
Message 9 of 13
(3,780 Views)
hi again,
i was wondering if you could help with another problem. i've written the programme including the case structure, and basically it takes in an input from a waveform and then gets an element from the waveform and compares it to a constant value (in this case 0.1), if the statement is true the first case structure runs and if it is false the second runs, basically the programme in the case structure just writes a list of values as an output voltage and this programme runs fine on its own. however, the case structure isn't executing, have i wired it up wrong or am i missing something.
thanks
ruth
0 Kudos
Message 10 of 13
(3,749 Views)