From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

case structure output

无标题.png

When the case is True, the output of case structure is a number, which is the result of a comparison.

222.png

When the case is False, the output is 0 (by default)..

But I don't need these 0s, actually I don't need the False case, I only need the output of True case. My question is How to only execute True case and avoid the output of False case?

0 Kudos
Message 1 of 7
(4,211 Views)
Then you should not be using the Case structure at all. Just have only the code in True case and execute, which will give the result from the comparison. You need to work on the algorithm to find the right logic and then implement it.
-----

The best solution is the one you find it by yourself
Message 2 of 7
(4,202 Views)

Hi,

the condition of executing Truse case is also a result of comparison, so I might still need to use Case Structure.

When the comparison is True, I need some output. 

When the comparison is False, I don't need any execution, but the output of case structure is still a consecutive 0s.

 

 

11111.png

0 Kudos
Message 3 of 7
(4,196 Views)

What do you mean you don't need any output?  There always has to be something on the wire coming out of the case structure.

 

Are you using a newer version of LabVIEW?  Is it a case that you don't want a value coming out of the For Loop at the auto-indexing tunnel?  If so, then change the auto-indexing tunnel into a conditional tunnel.

 

PS:  You don't need to add 1 or subtract 1 from a wire.  There are functions in the Numeric palette called Increment and Decrement that add or subtract 1 in a single function without having to place the 1 constant.

Message 4 of 7
(4,188 Views)

Hi,

Yes I don't want any output of For Loop when the case is False. I tried to use contional tunnel mode as you said and got the result I want. Thanks`

0 Kudos
Message 5 of 7
(4,181 Views)

Hi cantata2014,

Then in that you need to use "shift registers" and "build array" function where the all the inputs to case structure during false case are wired to shift register right side of the for loop and the output is added to array only during the true case .

 

Regards,

Srikrishna.J

Regards,
Srikrishna


0 Kudos
Message 6 of 7
(4,177 Views)

@srikrishnaNF wrote:

Hi cantata2014,

Then in that you need to use "shift registers" and "build array" function where the all the inputs to case structure during false case are wired to shift register right side of the for loop and the output is added to array only during the true case .

 

Regards,

Srikrishna.J


You need to do that if you have an older version of LabVIEW before conditional tunnels were added.  Newer versions with conditional tunnels make the code a whole lot simpler.

0 Kudos
Message 7 of 7
(4,174 Views)