Thursday, 2 June 2016

MATLAB Programming 23 - Functions for Bitwise Operations (1)

Bitwise operators work on bits and perform bit-by-bit operation.

Assume if A = 60; and B = 13; Now in binary format they will be as follows:
A = 0011 1100
B = 0000 1101
-----------------
A&B = 0000 1100

A|B   = 0011 1101

A^B  = 0011 0001

~A = 1100 0011

MATLAB provides various functions for bit-wise operations like 'bitwise and', 'bitwise or' and 'bitwise not' operations, shift operation, etc.


No comments:

Post a Comment