LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Case structure

Solved!
Go to solution

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.

0 Kudos
Message 1 of 10
(3,477 Views)
What are you wiring to the selector? It has to be a Boolean, a string, or a single numeric. Are you trying to connect an array?
0 Kudos
Message 2 of 10
(3,467 Views)
Solution
Accepted by topic author Mark87

Hi mark,

 

where is your problem?

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 10
(3,453 Views)

Thanks for your answer.You've been very helpful.

0 Kudos
Message 4 of 10
(3,436 Views)

I would have done this but, there are many ways to skin the cat.

!00.png


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 10
(3,370 Views)

Hi Jeff,

 

what happens in your snippet for an input array of [1, 1, -1, -1]?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 10
(3,347 Views)

@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.Smiley Wink


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 7 of 10
(3,321 Views)

@GerdW wrote:

Hi Jeff,

 

what happens in your snippet for an input array of [1, 1, -1, -1]?


Smiley Surprised

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.Smiley Tongue (insert rimshot!)

 

A cup of coffee and a few minutes give me two possibilities

!00.png

 

"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. 

Spoiler
there is nothing finer than that PZ^2 review process!

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 10
(3,305 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 10
(3,279 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 10 of 10
(3,277 Views)