LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

If, then with data sets

I am new to LabVIEW, I have only used it in school and now am working on a project.  I have a set of data and conditions that will determine a result.  It is a very simple thing to do in Excel using "IF" "AND" but I can't figure out how to do it on LabVIEW. Here is an example calling my conditions A, B, C and my results 1, 2, 3 (even though the results do not have to be numerical). 

 

If A and B are true, the result is 1.

If ONLY A is true, the result is 2.

If A and B and C are true, the result is 3.

 

There is always only going to be one result, so you cannot satisfy "A and B" and "Only A" in the same sample.  That is pretty much all it is except on a slightly larger scale.  I was trying to do this using the "AND" function and thought that there had to be an easier way. Ideally, I'd like the result to display on a single text box on my front panel. 

 

I did not include a block diagram mainly because I am so lost, I just need somewhere to start.  If anyone could just give me some quick help on what functions to look into, that would be really really appreciated. Thank you.

 

 

0 Kudos
Message 1 of 2
(2,536 Views)

Look in to nested case structures or state machines as good starting points. State machines will offer a more elegant solution, but will require a bit more coding. There is a template for a standard state machine in LabVIEW:

 

New>>VI>>From Template>>Design Patterns>>Standard State Machine

 

I have also attached an example of nested case structures modeled after your problem.

 

Tim W

Applications Engineering

National Instruments

http://www.ni.com/support 

0 Kudos
Message 2 of 2
(2,529 Views)