bitconcat
Concatenate bits of fi objects
Description
Examples
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.
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.
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.
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
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
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
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™.
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.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.
Amerika
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)