Products & Services Industries Academia Support User Community Company

Learn more about MATLAB   

bitand - Bitwise AND

Syntax

C = bitand(A, B)

Description

C = bitand(A, B) returns the bitwise AND of arguments A and B, where A and B are unsigned integers or arrays of unsigned integers.

Examples

Example 1

The five-bit binary representations of the integers 13 and 27 are 01101 and 11011, respectively. Performing a bitwise AND on these numbers yields 01001, or 9:

C = bitand(uint8(13), uint8(27))
C =
    9

Example 2

Create a truth table for a logical AND operation:

A = uint8([0 1; 0 1]);
B = uint8([0 0; 1 1]);

TT = bitand(A, B)
TT =
    0    0
    0    1

See Also

bitcmp, bitget, bitmax, bitor, bitset, bitshift, bitxor

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

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