matlab - Insert ASCII in LSB -
does know efficient method in order insert ascii value of characters in 8 least significant bits (lsb) of 16 bit number?
the idea comes in mind convert both numbers binary, replace last 8 characters, 16 bit number, ascii value in 8 bits. far know string operations expensive in computational time.
thanks
here matlab implementation of @user1118321 idea:
%# 16-bit integer number x = uint16(30000); %# character c = 'a'; %# replace lower 8-bit y = bitand(x,hex2dec('ff00'),class(x)) + cast(c-0,class(x))
Comments
Post a Comment