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: 

HOW DO I COUNT HOW MANY TIMES A CASE STRUCTURE IS USED

I have a case structure within a while loops that subtracts .5 from a given value until that value is negative, then it gets passed along. Is there a way I can count the amount of time the case structure goes around?

0 Kudos
Message 1 of 6
(3,000 Views)

A shift register or a feedback node.

0 Kudos
Message 2 of 6
(2,988 Views)

A case structure does not "go around" or subtracts anything. Where is "along"?

 

Show us your code so we can recommend a suitable solution.

0 Kudos
Message 3 of 6
(2,971 Views)

Would a simple loop not serve this purpose better? A simple less than comparison with zero using the less than comparison function, connected with the loop's stop button would be much simpler. The loop iteration index could then be passed on once the loop ends.

0 Kudos
Message 4 of 6
(2,947 Views)

The 'i' box in the loop is the loop counter, just send that one out (+1 since it starts at 0).

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 6
(2,928 Views)

During testing, you can place a breakpoint. The VI will pause if a breakpoint is encountered. Then just count the pauses...

 

Or, during testing, turn on execution highlighting and watch how many times it's executed.

 

During testing a indicator and a local with a increment also works. It's a hack but during testing it works very well.

 

I'm emphasizing during testing since these solutions should not end up in a decent program. But it seems your trying to figure out what's going on. For testing they work very well.

0 Kudos
Message 6 of 6
(2,918 Views)