LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Case Statements

I'm working on a program and have a problem with a case statement. I have a tunnel spitting data out of case 1, but the program refuses to compile because I don't have any data exiting the tunnel for case 0. But the thing is, I'm building an array, and don't want anything from case 0 added to the array. How do I fix this?
0 Kudos
Message 1 of 4
(2,795 Views)
Make case 1 the default case then right click on the tunnel and select use default if unwired.

Hope this helps

Joe



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 2 of 4
(2,795 Views)
Joe,

Actually "use default if unwired" has nothing to do with any "default case" and does not require the presence of a default case. It simply assigns the default value for the given data type to the output tunnel in cases where it is not wired.
(examples: a DBL gets 0, a boolean gets "false", a string gets "empty string", ...).

Kura,
Are you are building an array in a loop coming from a shift register? In this case you would wire the existing array across so nothing is added unless the other case is selected. If you leave it unwired and set to "use default if unwired", your entire array would be replaced by an empty array.

If I did not understand your problem correctly, please clarify and maybe show a small example.
0 Kudos
Message 3 of 4
(2,795 Views)
Thanks for clearing up my mistake. Kura Altenbach is correct. After reading your question again I realize I was wrong. sorry for that, thanks again altenbach.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 4 of 4
(2,795 Views)