bitreplicate
Replicate and concatenate bits offi
object
Syntax
c
= bitreplicate(a
,n
)
Description
concatenates the bits inc
= bitreplicate(a
,n
)fi
objecta
n
times and returns an unsigned fixed-point value. The word length of the outputfi
objectc
is equal ton
times the word length ofa
and the fraction length ofc
is zero. The bit representation of the stored integer is in two's complement representation.
The inputfi
object can be signed or unsigned.bitreplicate
concatenates signed and unsigned bits the same way.
bitreplicate
only supportsfi
objects with fixed-point data types.
bitreplicate
does not support inputs with complex data types.
Sign and scaling of the inputfi
object does not affect the result type and value.
Examples
The following example usesbitreplicate
to replicate and concatenate the bits offi
objecta
.
a = fi(14,0,6,0); a_binary = a.bin c = bitreplicate(a,2); c_binary = c.bin
MATLAB®returns the following:
a_binary = 001110 c_binary = 001110001110