Main Content

bitcmp

Bit-wise complement of fi object

Description

cmp = bitcmp(A) returns the bit-wise complement of fi object A. When A has a signed numerictype, then the bit representation of the stored integer is in two's complement representation.

Note

To take the bit-wise complement of an input with double or integer data type, use the MATLAB® bitcmp function.

example

Examples

collapse all

Define an unsigned fixed-point fi object A with a value of 10, word length 4, and fraction length 0, then take the complement.

A = fi(10,0,4,0);
cmp = bitcmp(A);

You can see the complement operation when the numbers are shown in binary.

disp(bin(A))
1010
disp(bin(cmp))
0101

Input Arguments

collapse all

Input value, specified as a fixed-point fi scalar, vector, matrix, or multidimensional array.

Example: A = fi(10,0,4,0);

Data Types: fi

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

HDL Code Generation
Generate VHDL, Verilog and SystemVerilog code for FPGA and ASIC designs using HDL Coder™.

Version History

Introduced before R2006a