From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

compare elements

Solved!
Go to solution

How do I comare elements in an array and output a T/F?   I want to stop my while loop IF two elements in the array are equal.

Eric Yuzon
Senior engineer
ERC
Walled Lake, MI 48390
ericyuzon@e-reman.com
e-reman.com
0 Kudos
Message 1 of 15
(3,283 Views)
Solution

Like this with a equal and OR Array Elements function. Make sure the Equal function is set to compare elements and make sure the data type you are comparing is an integer type.

 

0 Kudos
Message 2 of 15
(3,273 Views)

what is the second compare?  i cant find it?

Eric Yuzon
Senior engineer
ERC
Walled Lake, MI 48390
ericyuzon@e-reman.com
e-reman.com
0 Kudos
Message 3 of 15
(3,263 Views)

OR Array Elements like I said.

 

See the 'Search' button on the Functions palette? You can use that. It also seems that you are using LabVIWE 2009. That image is a 'snippet'. You just have to drag it to a block diagram.

0 Kudos
Message 4 of 15
(3,255 Views)

I found it!   Thanks!

Eric Yuzon
Senior engineer
ERC
Walled Lake, MI 48390
ericyuzon@e-reman.com
e-reman.com
0 Kudos
Message 5 of 15
(3,246 Views)

Now my next question is related but more involved.   How do I do a bitwise compare within the element?   Maybe a bit mask of some sort?

Eric Yuzon
Senior engineer
ERC
Walled Lake, MI 48390
ericyuzon@e-reman.com
e-reman.com
0 Kudos
Message 6 of 15
(3,239 Views)

Yes, you can use a mask..

 

I'm a little confused...  Do you want to implement that as part of the code example Denis provided?  Or is it a different topic?

0 Kudos
Message 7 of 15
(3,235 Views)

The code works for the hex compares.  Now I have to use the same code modified for bit compares.  How do I implement a bit mask?

Eric Yuzon
Senior engineer
ERC
Walled Lake, MI 48390
ericyuzon@e-reman.com
e-reman.com
0 Kudos
Message 8 of 15
(3,218 Views)

Here is an example of how to do several things concerning bit masking.

 

18499iC28F61102189BA7D

- tbob

Inventor of the WORM Global
0 Kudos
Message 9 of 15
(3,207 Views)

Example_VI.png

 

 

You simple AND them together..

0 Kudos
Message 10 of 15
(3,205 Views)