Can my Simulink 6.1 (R14SP1) bitwise operator block work with the sign bit?

1 view (last 30 days)
I have a signal carrying a signed data type being fed into a bitwise operator block. The bitwise operator block, like in C in the attached model 'bitwise_sign.mdl' , does not operate on the sign bit. I would like to have the bitwise operator block work with the sign bit.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This enhancement has been incorporated in Release 2007a (R2007a). For previous product releases, read below for any possible workarounds:
The ability to have a bitwise operator operate on a sign bit is not available in Simulink. To work around this issue, convert the signal with the signed data type to an unsigned data type using a Data Type Conversion block. In the Data Type Conversion block, set the 'Input and Output to have equal' parameter value to 'Stored Integer'--this causes Simulink to avoid any scaling of the input. After running the unsigned value through the bitwise operator block, use another Data Type Conversion block, with 'Input and Output to have equal' parameter set to 'Stored Integer', to convert back to a signed integer.
An example model 'bitwise_sign.mdl' is attached with the solution.

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!