Skip to Main Content Skip to Search
Product Documentation

bitor - Bit-wise OR

Syntax

C = bitor(A,B)

Description

C = bitor(A,B) calculates the bit-wise OR of arguments A and B.

Input Arguments

A,B

Inputs, specified as one of these types:

  • Unsigned integer or array of unsigned integers.

  • .NET enumeration object.

Output Arguments

C

Result of operation, same type as inputs.

Examples

Calculate the bit-wise OR of the integers 13 and 27. The five-bit binary representations of integers 13 and 27 are 01101 and 11011, respectively. The result is 11111, or 31.

C = bitor(uint8(13), uint8(27))
 

Create a truth table for a logical OR operation.

A = uint8([0 1; 0 1]);
B = uint8([0 0; 1 1]);
TT = bitor(A, B)

MATLAB displays:

TT =
    0    1
    1    1
 

Create an instance allMeetingDays using the NetDocEnum.MyDays enumeration described in Use Bit Flags with .NET Enumerations:

allMeetingDays = bitor(bitor(...
    NetDocEnum.MyDays.Friday,...
    NetDocEnum.MyDays.Wednesday),...
    NetDocEnum.MyDays.Monday)

See Also

bitand | bitcmp | bitget | bitmax | bitnot | bitset | bitshift | bitxor

  


» Learn more
» Download free kit
» Get trial software

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS