bitconcat
Concatenate bits of fi
objects
Description
Examples
Concatenate the Elements of a Vector
Create a fixed-point vector.
a = fi([1,2,5,7],0,4,0); disp(bin(a))
0001 0010 0101 0111
Concatenate the bits of the elements of a
.
y = bitconcat(a)
y = 4695 DataTypeMode: Fixed-point: binary point scaling Signedness: Unsigned WordLength: 16 FractionLength: 0
disp(bin(y))
0001001001010111
The word length of the output, y
, equals the sum of the word lengths of each element of a
.
Concatenate the Bits of Two fi Objects
Create two fixed-point numbers.
a = fi(5,0,4,0); disp(bin(a))
0101
b = fi(10,0,4,0); disp(bin(b))
1010
Concatenate the bits of the two inputs.
y = bitconcat(a,b)
y = 90 DataTypeMode: Fixed-point: binary point scaling Signedness: Unsigned WordLength: 8 FractionLength: 0
disp(bin(y))
01011010
The output, y
, is unsigned with a word length equal to the sum of the word lengths of the two inputs, and a fraction length of 0.
Perform Element-by-Element Concatenation of Two Vectors
When a
and b
are both vectors of the same size, bitconcat
performs element-wise concatenation of the two vectors and returns a vector.
Create two fixed-point vectors of the same size.
a = fi([1,2,5,7],0,4,0); disp(bin(a))
0001 0010 0101 0111
b = fi([7,4,3,1],0,4,0); disp(bin(b))
0111 0100 0011 0001
Concatenate the elements of a
and b
.
y = bitconcat(a,b)
y = 23 36 83 113 DataTypeMode: Fixed-point: binary point scaling Signedness: Unsigned WordLength: 8 FractionLength: 0
disp(bin(y))
00010111 00100100 01010011 01110001
The output, y
, is a vector of the same length as the input vectors, and with a word length equal to the sum of the word lengths of the two input vectors.
Perform Element-by-Element Concatenation of Two Matrices
When the inputs are both matrices of the same size, bitconcat
performs element-wise concatenation of the two matrices and returns a matrix of the same size.
Create two fixed-point matrices.
a = fi([1,2,5;7,4,5;3,1,12],0,4,0); disp(bin(a))
0001 0010 0101 0111 0100 0101 0011 0001 1100
b = fi([6,1,7;7,8,1;9,7,8],0,4,0); disp(bin(b))
0110 0001 0111 0111 1000 0001 1001 0111 1000
Perform element-by-element concatenation of the bits of a
and b
.
y = bitconcat(a,b)
y = 22 33 87 119 72 81 57 23 200 DataTypeMode: Fixed-point: binary point scaling Signedness: Unsigned WordLength: 8 FractionLength: 0
disp(bin(y))
00010110 00100001 01010111 01110111 01001000 01010001 00111001 00010111 11001000
The output, y
, is a matrix with word length equal to the sum of the word lengths of a
and b
.
Input Arguments
a
— Input array
scalar | vector | matrix | multidimensional array
Input array, specified as a scalar, vector, matrix, or multidimensional
array of fixed-point fi
objects. bitconcat
accepts varargin
number
of inputs for concatenation.
Data Types: fixed-point fi
b
— Input array
scalar | vector | matrix | multidimensional array
Input array, specified as a scalar, vector, matrix, or multidimensional
array of fixed-point fi
objects. If b
is
nonscalar, it must have the same dimension as the other inputs.
Data Types: fixed-point fi
Output Arguments
y
— Output array
scalar | vector | matrix | multidimensional array
Output array, specified as a scalar, vector, matrix, or multidimensional
array of unsigned fixed-point fi
objects.
The output array has word length equal to the sum of the word lengths of the inputs and a fraction length of zero. The bit representation of the stored integer is in two's complement representation. Scaling does not affect the result type and value.
If the inputs are all scalar, then bitconcat
concatenates
the bits of the inputs and returns a scalar.
If the inputs are all arrays of the same size, then bitconcat
performs
element-wise concatenation of the bits and returns an array of the
same size.
Extended Capabilities
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™.
For VHDL®, generates the concatenation operator: (a &
b)
.
For Verilog®, generates the concatenation operator: {a ,
b}
.
Version History
Introduced in R2007b
See Also
bitand
| bitcmp
| bitor
| bitreplicate
| bitget
| bitset
| bitsliceget
| bitxor
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)