LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help needed using Case structure

Solved!
Go to solution

I was wondering how to control an  case structure if the condition is false . I was trying to set if the entered string  matches perform the multiplication or else if the string entered doesnt matches just retain the previous value. In directly to say take no action if the string entered is not matching.

 

 

-lucky.

0 Kudos
Message 1 of 10
(3,217 Views)
Not sure I understand your question but if you want to keep the value of x2 the same if the strings do not match, jusr wire it through the false case insted of using the default value if unwired.
========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 10
(3,214 Views)

Hello RTSLVU,

 

                     we dont want to display the x value if the entered string is unmatched it should holds its previuos value what was there in indicator. Say for the first time if the entered string matches with the string constant in the code and the value of 'x' is  5 and value of 'y' is 20 the o/p in indicator is displayed as 100. For the second time if the entered string doesnt matches it should still display as 100 i.e the previous vale itself.

0 Kudos
Message 3 of 10
(3,210 Views)
Oh, ok then you just need to use a shif register
========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 10
(3,205 Views)
Or a local variable
========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 10
(3,202 Views)

This is what exactly Iam looking for. But Cant we use this with out the help of while loop. Because I want to insert this piece of code some where in a big part of code so adding a control to the while loop is messing up my code. .

 

 

0 Kudos
Message 6 of 10
(3,200 Views)
Solution
Accepted by topic author lucky_k

Thank you very much the local variable has solved my probelm..

 

 

-lucky

0 Kudos
Message 7 of 10
(3,195 Views)
In the original VI you posted, simply move the indicator inside the true case. DO NOT use a local variable
0 Kudos
Message 8 of 10
(3,184 Views)

Dennis,

 

           The piece of code(case structure) which i posted is actually inside a for loop and i want to record the data outside the for loop. so I cant move the indicator  into the case statement. Will there be any problem if I use the local variable? or is there any other better way to handle this case.

0 Kudos
Message 9 of 10
(3,172 Views)

Then put the shift register on the edge of the for loop.

 

The problem with local variables is that they are easy to misuse and it's better to learn how to avoid them. Later, when you have more programming experience, you will understand when and how they can be used.

0 Kudos
Message 10 of 10
(3,165 Views)