LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Case Structure Fandangaling, How to Bypass Missing Alignment Tunnel Error

Hello! 

 

I'm trying to use some case structures to change the values for inputted data and have encountered a slight issue. I'm dicing up my inputted data due to restrictions with the broadcasting method.

 

In it's most simplified form imagine you have three strings, 1,2, and 3 that have been inputted. The first letter represents which case it will relate to.

String 1: ADEF

String 2: BGHF

String 3: CIJK

 

When using case structures there will be interference as the 3rd string will not have an output for variable F. Leading to a missing assignment to tunnel error. Is there a way to work around this? I could remove the second F variable. However, the idea is to update variable F more frequently than once every string cycle. 

 

Any help would be much appreciated!

0 Kudos
Message 1 of 3
(144 Views)

LabVIEW doesn't allow for structures to not have something to do for all outputs, and for any value that could some in on the selector terminal. 

 

Right now, even if you did fix your current problem, you are going to have another problem because you don't have a case in your structure that isn't for the value 65,66, or 67.

 

At the very least you will need to set one of the three cases to be your "Default" case, where it goes if nothing else specific matches.  I would recommend creating a 4th case to be the default one, and have it create an error popup and stop the loop, since it's clearly been given bad data.

 

For the output, on the 3rd case where you don't have an "F", you have 3 main options:

  1. In the cases with no F, output the last set value of F instead (Use either a local variable or a feedback node to get it)
  2. Right-click the terminal leading to F and select "Use default if unwired", which will output a value of zero in the cases with no F (probably not what you want, but it will let it run)
  3. Put the "F" update terminal in its own case structure by itself that updates either on a 65 or a 66.  This could either use the same input wire and just have 2 numbers for one case and all others ("default") on an empty case, or you could have it be a Boolean case and have each case of your main case output either a True or a False indicating whether or not F should be updated.  Then just add a constant zero and False to each case without an F, and wire up a True to each case that does update F.

 

0 Kudos
Message 2 of 3
(133 Views)

It took a lot of head-scratching (on my part) and looking at your code (thanks for using an "older" version of LabVIEW, as long-time LabVIEW users (now) don't tend to upgrade every year, as we did in the past).

 

Many things are "wrong" here.  It makes no sense to pass a string where the first letter is an identifier (which string, 1, 2, or 3), and the remaining letters are "things to do" (which can refer to other numeric quantities, i.e. an array of selectors.  Why do you subtract 17 from all of the input array letters?  You see to have 8 outputs (I would number them "Out1", "Out2", etc.), and on each of your three "tasks", you want to change three of them.

 

So ask yourself, how do you want to represent the 8 quantities you might want to change?  An array of 8 "things"?  How do you know, given a particular Instruction (which can be one of three) which subset to change?  (If I give you an Array, and say "Change the third element to a 24", do you know how to do this in LabVIEW?  Do you know the array index that corresponds to the third element?  [Hint -- it isn't 3].)

 

Once you start thinking clearly about What you want to do, and think of the logical way to organize your data (almost never by letters in a String -- strings are usually reserved for text messages, instructions, etc., not data), and put off the "How to do it" until the "What" is clear, the easier LabVIEW will become.  [Note that prioritizing What over How works for almost all Programming Languages].

 

Bob Schor

0 Kudos
Message 3 of 3
(114 Views)