LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I implement this logic

Hi,

I have 3 input parameters. One is a random value .

Inside a loop I read this random value . bsed on this value I would like to select between the other parameters.Let me use an example.

 

X is the random value. Y and Z are the other 2 parameters. 

 

1- In the first iteration if X is greater than previous X , I would like to show the value of Z

2- In the second iteration If X< greater than preious X then I would like to keep showing Z if not I show Y

3-  ( lets say we are showing y) In the 3rd iteration If X< greater than preious X then I would like to keep showing Y if not I show Z

 

So as said the value of X is used to toggle between Z and Y so when the condition is met we keep showing y or Z if not we show the other parameter.

 

Could you please help me to implement this logic in LV

Thanks

 

 

0 Kudos
Message 1 of 5
(2,572 Views)

Tried anything yet?

 

You can do some logic and ranges in the case structure if the input is a number. 

You can also pull up/down the shift register terminals to get the previous n entries of the shift register.

0 Kudos
Message 2 of 5
(2,561 Views)

Hi SnowMule,

 

I have used shift register for X so I continuously read X and compare it with the previous X , but I don't know how can I relate that to select Y and Z. I don't want to select Y and Z if the result is true or false. I would like to continue reading one of them if the condition is true and then read the other one if the condition is false

0 Kudos
Message 3 of 5
(2,551 Views)

I have attached my vi but it is not working in a way that I like

Now when the condition is true I see A and when not I see B 

But I would like to see A or B as long as the condition is true and switch to the other one if the condition is false

0 Kudos
Message 4 of 5
(2,537 Views)

You only need a shift regsiter with a single output, your solution seems a bit convoluted. 😉

 

Anyway, if you want to switch whenever the comparison is false, here's what you would do. Modify as needed.

0 Kudos
Message 5 of 5
(2,518 Views)