MATLAB: Uint16 to uint8

uint16uint8

Dear all,
I wonder whether there is an efficient way of converting an uint16 array of length N in an uint8 array of length 2N, so essentially replacing every 16bit word with two bytes:
e.g.
15000 => 58, 152
11000 => 42, 248.
The simplest implementation would be to convert decimal to binary string with 16 elements, and then split them 1..8 and 9…16, but I wonder if we can do another way.
Thank you in advance!

Best Answer

u16 = your uint16 variable
u8 = typecast(u16,'uint8');