LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bitwise or and and in an array

Hello!

Now I have this problem: The "array" is done, but then I want in the "array 2" I want to do this: I want to check if the bits is the same, and then I want a one out. If they are different I want a zero out. For example in my attached VI I have 665 and 409. That is 01010011001 and 409 is 00110011001. We have a number with 11 bits, that is why the extra zeros is there... Then the result should be 10011111111, that is 4FF hex and 1279 dec... hope anyone get how I mean :P. The problem is that I do not get how to do the bitwise operation... see the attached VI. I would be happy if anyone has any idea 🙂 Thank you and best regards
0 Kudos
Message 1 of 8
(3,191 Views)
Hello,

The not XOR functions does exactely what you want.

Hope this helps,
Paulo
0 Kudos
Message 2 of 8
(3,191 Views)
Hello!

Yes I thought of that too... but the problem is that sometimes there could be for example three numbers in a column... and then if there are three ones if I use the not XOR-function then I get zero out... but I want it to be one when the elements are the same... maybe I should have explained that too :-)... thank you for your help! Best regards.
0 Kudos
Message 3 of 8
(3,184 Views)
If one have for example as this... see the attached VI 🙂
0 Kudos
Message 4 of 8
(3,182 Views)
Look at this modification using XOR and an extra inversion in case of an odd number of iterations of the for loop.

Lynn
Message 5 of 8
(3,176 Views)
Hello!

Thank you for your help! The problem is that it seems to not work with not xor anyway... what we want to do is to check if the bits are equal... then get a one on the output... is there a way to do this bitwise? The problem is that one has to initiate something to compare with from the beginning... For example if we have 000 then we want a one on the output and the same if it is 111 but if it is 101 we want a zero out. Maybe this can not be done bitwise? Thank you for your help! Best regards!
0 Kudos
Message 6 of 8
(3,157 Views)
Is something like this (see Array 3) more like what you need?

The idea is:
1. Each number from a given column is changed into a Boolean array. Thus the entire column becomes a 2D Boolean array.
2. The 2D Boolean is transposed. Then autoindexing will extract a row which represents a particular bit for all the numbers in the original column.
3. Determine if all bits are 0's or all 1's.
4. Auto-index to create an array of Booleans for these bits.
5. Convert Boolean array back to number.
6. Auto-index these numbers into an array.

-Kevin P.
CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 7 of 8
(3,139 Views)
Hello!

Thank you for your help! It was very useful 🙂

Best regards!
0 Kudos
Message 8 of 8
(3,125 Views)