Why is simulink data type conversion block altering the data when it should be typecasting?
Posted
by Nick
on Stack Overflow
See other posts from Stack Overflow
or by Nick
Published on 2010-05-20T16:07:15Z
Indexed on
2010/05/20
16:10 UTC
Read the original article
Hit count: 206
I am attempting to typecast some data from int32 to single. I first tried using the 'Data Type Conversion' block with single output data type and the Stored Integer option. However, I found that the datatype conversion block is not typecasting the data the way I expect it to. Am I using the block incorrectly, or is it failing to work as it should?
temp1 (pre conversion):
uint32: 1405695244
single: 1728356810752.000000
binary: 01010011110010010011010100001100
temp2 (post conversion):
uint32: 1319604842
single: 1405695232.000000
binary: 01001110101001111001001001101010
By the way, I have gotten around the issue by using an embedded Matlab block to perform the typecasting operation.
© Stack Overflow or respective owner