How to get two 16-bit numbers from a 32bit number
20 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
HI
I have 32-bit variable.
I would like to split this into two 16-bit numbers, How can i do this?
0 Kommentare
Antworten (1)
James Tursa
am 16 Aug. 2022
Bearbeitet: James Tursa
am 16 Aug. 2022
E.g., to split a uint32 into two uint16 you can use typecast( ):
result = typecast(your_variable,'uint16')
This result will contain the original bit pattern of the input variable.
2 Kommentare
James Tursa
am 16 Aug. 2022
Yes. typecast( ) simply re-interprets all of the 32-bit patterns as 16-bit patterns as they appear in memory. So an array input will result in an array output with twice as many elements. Is this not what you want? If you want something different you will have to give a short example of input and desired output.
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!