how to convert 2 double number and packed in 32 bit
9 次查看(过去 30 天)
显示 更早的评论
hi i want to convert 2 double number 0.5 and -0.5 in 16 bit and packed into 32 bit. each number in double takes 8 bytes. i want to convert in this number in fixed point 16,14 (2 bytes). and finally i want to packed these 2 number in 32 bit(4 bytes). please tell me how i can do this operation in matlab
2 个评论
Walter Roberson
2015-8-21
Does 16,14 indicate 1 sign bit, then 1 bit of integer, then 14 bits of fraction? Or do you want to use 2s complement?
回答(1 个)
Walter Roberson
2015-8-21
编辑:Walter Roberson
2015-8-21
typecast(int16(x*2^14),'uint32')
is one possibility depending on what you mean by 16,14
3 个评论
Walter Roberson
2015-8-24
typecast(storedInteger([FirstFi, SecondFi]),'uint32')
or you might need
typecast([storedInteger(FirstFi), storedInteger(SecondFi)], 'uint32')
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!