Let's say I have an array of singles, like: a=[0.923834,0.8234234,0.234234,0.23414]
If I want to convert this to a byte array, where each number is represented by 4 bytes, I've been doing:
b=[]; for i=1:length(a)/2 b=[b;typecast(single(a((i-1)*2+1)),'uint8');typecast(single(a((i-1)*2+2)),'uint8')] end
Is there an easier, less complex way of doing this?