This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Bitwise OR of two fi objects


c = bitor(a,b)


c = bitor(a,b) returns the bitwise OR of fi objects a and b. The output is determined as follows:

  • Elements in the output array c are assigned a value of 1 when the corresponding bit in either input array has a value of 1.

  • Elements in the output array c are assigned a value of 0 when the corresponding bit in both input arrays has a value of 0.

The numerictype properties associated with a and b must be identical. If both inputs have a local fimath, their local fimath properties must be identical. If the numerictype is signed, then the bit representation of the stored integer is in two's complement representation.

a and b must have the same dimensions unless one is a scalar.

bitor only supports fi objects with fixed-point data types.


The following example finds the bitwise OR of fi objects a and b.

a = fi(-30,1,6,0);
b = fi(12, 1, 6, 0);
c = bitor(a,b)

c =

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 6
        FractionLength: 0

You can verify the result by examining the binary representations of a, b and c.

binary_a = a.bin
binary_b = b.bin
binary_c = c.bin

binary_a =


binary_b =


binary_c =


Extended Capabilities

See Also

| | | |

Introduced before R2006a

Was this topic helpful?