How can I specify the data type of the output of an Extract Bits block in Simulink 6.1 (R14SP1)?

3 views (last 30 days)
Instead of having the Extract Bits block output a fixed point data type of the appropriate size, I would like to be able to specify the output data type. For example, if the input is a uint8 and the upper half bits are being extracted, the output will be of type ufix4_E4. I would like to be able to specify the output as a zero-padded uint8.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 28 Dec 2009
The ability to specify the output type of the Extract Bits block is not available in Simulink.
To work around this issue, use a combination of Shift Arithmetic and Bitwise AND blocks to extract the bits.
For example, to extract the upper 4 bits of a uint8 signal, pass it through a Shift Arithmetic block that shifts 4 positions to the right followed by a Bitwise AND with 0x0F. The model below, extractbits.mdl, illustrates how this can be done.

More Answers (0)

Products


Release

R14SP1

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!