02-19-2014 01:57 PM
I have a problem with LabVIEW. I have a columns vector and after I have a numeric value: -1. I would like to do this. When all the cells of the columns vector are equal to -1 I desire that the true (or false) of a case structure is activated. The problem is that when I do this there is a problem. LabVIEW said I have linked two terminals of differents dimensions. How Can I by-pass the problem? What's the matter?
Thanks to everyone ho help me.
Solved! Go to Solution.
02-19-2014 02:05 PM
02-19-2014 02:30 PM
02-19-2014 03:11 PM
Thanks for your answer.You've been very helpful.
02-20-2014 01:00 PM
I would have done this but, there are many ways to skin the cat.
02-21-2014 01:46 AM
02-21-2014 09:34 AM
@GerdW wrote:
what happens in your snippet for an input array of [1, 1, -1, -1]?
He would have found the bug and done it your way.
02-21-2014 11:56 AM - edited 02-21-2014 11:58 AM
@GerdW wrote:
Hi Jeff,
what happens in your snippet for an input array of [1, 1, -1, -1]?
You're right of course. I know there has got too be a bitwise way to work on the array though. Increment and sum array can be spoofed as easilly.
The point being: to not need to compare every value of the array. What a waste if machine cycles! since we only care if any bit is 0 why compare them all). Although I should have taken a bit of time to think it through just a "bit" more. (insert rimshot!)
A cup of coffee and a few minutes give me two possibilities
"Type cast - search" halts at the first True but needs to compare all values in the case we desire to find.
"Min/Mix- And" might benchmark better in certain situations.
Thankfully I got some excellant code review processes (Gerd and Tim) backstoping my play.
02-22-2014 07:22 AM - edited 02-22-2014 07:22 AM
Jeff·Þ·Bohrer wrote:
Thankfully I got some excellant code review processes (Gerd and Tim) backstoping my play.
You forgot Christian in that list as well. But since you put out the challenge...
A trick I often do is use a FOR loop to do the comparison. Starting with 8.6 (or was it 8.5?), you can right-click on the FOR loop and make the conditional terminal viewable. So I just do the comparison one item at a time and quit when I find the bad apple. This way you only check as many as needed.
02-22-2014 07:34 AM
Jeff·Þ·Bohrer wrote:
"Type cast - search" halts at the first True but needs to compare all values in the case we desire to find.
It also doesn't work of you have a value other than 0 in each byte of the array. I'm playing with I32 (just needed to put that out so we are on the same page). So a value of 0x1111 1111 (286331153) when type cast into a boolean array will give {T, T, T, T}. Anything other than a 0 is a True (C does the same thing). And your search for a False will fail, giving a false positive of all -1.