how to convert 2 double number and packed in 32 bit
22 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Walter Roberson
am 21 Aug. 2015
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?
Antworten (1)
Walter Roberson
am 21 Aug. 2015
Bearbeitet: Walter Roberson
am 21 Aug. 2015
typecast(int16(x*2^14),'uint32')
is one possibility depending on what you mean by 16,14
3 Kommentare
Walter Roberson
am 24 Aug. 2015
typecast(storedInteger([FirstFi, SecondFi]),'uint32')
or you might need
typecast([storedInteger(FirstFi), storedInteger(SecondFi)], 'uint32')
Siehe auch
Kategorien
Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!