Documentation

bitreplicate

Replicate and concatenate bits offiobject

Syntax

c= bitreplicate(a,n)

Description

c= bitreplicate(a,n)concatenates the bits infiobjectantimes and returns an unsigned fixed-point value. The word length of the outputfiobjectcis equal tontimes the word length ofaand the fraction length ofcis zero. The bit representation of the stored integer is in two's complement representation.

The inputfiobject can be signed or unsigned.bitreplicateconcatenates signed and unsigned bits the same way.

bitreplicateonly supportsfiobjects with fixed-point data types.

bitreplicatedoes not support inputs with complex data types.

Sign and scaling of the inputfiobject does not affect the result type and value.

Examples

The following example usesbitreplicateto replicate and concatenate the bits offiobjecta.

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

Extended Capabilities

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

Introduced in R2008a

Was this topic helpful?