bitconcat - Concatenate bits of fi objects

Syntax

y = bitconcat(a, b)
y = bitconcat([a, b, c])
y = bitconcat(a, b, c, d, ...)

Description

y = bitconcat(a, b) concatenates the bits in the fi objects a and b.

a and b can both be vectors if the vectors are the same size. If a and b are vectors, bitconcat performs element-wise concatenation. bitconcat only supports vector input when both a and b are vectors.

y = bitconcat([a, b, c]) performs element-wise concatenation of the bits of fi objects a, b, and c, as given by the input vector.

y = bitconcat(a, b, c, d, ...) concatenates the bits of the fi objects a, b, c, d, ....

bitconcat returns an unsigned fixed value with a word length equal to the sum of the word lengths of the input objects and a fraction length of zero. The bit representation of the stored integer is in two's complement representation.

The input fi objects can be signed or unsigned. bitconcat concatenates signed and unsigned bits the same way.

bitconcat only supports fi objects with fixed-point data types. bitconcat does not support inputs with complex data types. Scaling does not affect the result type and value. bitconcat accepts varargin number of inputs for concatenation.

Example

This example shows how to get the binary representation of the concatenated bits of two fi objects. Consider the following unsigned fixed-point fi objects. The first has a value of 5, word length 4, and fraction length 0. The second has a value of 10, word length 4, and fraction length 0:

a = fi(5,0,4,0);
disp(bin(a))

0101

b = fi(10,0,4,0);
disp(bin(b))

1010

Concatenate the objects:

c = bitconcat(a,b);
disp(bin(c))

01011010

See Also

bitand, bitcmp, bitor, bitreplicate, bitset, bitsliceget, bitxor

  


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