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: 

ignore case default

Hello,

 

I want to know how to ignore the default case of case structure. Please see attachment.

 

I expect to get the output array be [6, 7,10, 16, 24, 36]. Instead, I get [0, 6, 7, 0, 0, 10, 0, 0, 0,....]. When the case structure encounters default case, it also outputs 0 to the array.

 

Please help me. Thank you.

0 Kudos
Message 1 of 6
(2,424 Views)

Hi,

 

Default case run when there is no case match at case selector. So those times when zero comes was the time when no case match at case selector.

 

One quick solution can be to search zero in your output and delete them from array using index from search. Else change your logic at case selector.

 

- HS

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

Hi

 

What you need to do is pretty simple. Keep the 0 case as default and everytime you hit this case you just need to let the shift register pass through the for loop without adding any new elements this way you will end up with the array you expected.

 

Sletten

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

Hi,

 

Check this out.. I guess this is the solution.

 

Regards,


Nitzz

(Kudos are always WelcomeSmiley Wink)

Message 4 of 6
(2,399 Views)

Thank you for all responses. Another question.

 

 

Regarding to FOR LOOP. Can we assign the initial value of i ? Like in C language for (i=5; i++; i<10).

Thank you.

0 Kudos
Message 5 of 6
(2,367 Views)
No, you'll have to place I+5 in the loop to get an offset.
G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

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