04-08-2024 01:03 PM
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!
04-08-2024 01:21 PM
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:
04-08-2024 01:43 PM
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