MATLAB: Is there a block in Simulink that directly supports bit equivalent conversion from single to an unsigned integer

bitconversiondataequivalentfrominputintegeroutputprecisionsimulinksinglestoredtotypeunsignedxpc

I am currently developing a model where signals of single precision data type must be packed into CAN messages. There is no block which directly supports bit equivalent conversion from single to unsigned integer. Simulink supports a Data Type Conversion block where the “Input and output to have equal:” option can be set to “Stored Integer (SI)”. However, the “integer” casting is done before the “stored” conversion is performed.

Best Answer

The ability to perform bit equivalent conversion from single to unsigned integer directly, using a block, is currently not available in Simulink. To work around this issue, you can write an S-function that performs the casting operation as shown in the attached model.
Related Question