Convert a value to corresponding binary string in length byte This function is used in converting a sound to a Wav file.
0001 function s=urbiInt2Chars(i, length) 0002 % Convert a value to corresponding binary string in length byte 0003 % 0004 % This function is used in converting a sound to a Wav file. 0005 0006 base = 2^((length - 1)* 8); 0007 s = floor(i / base); 0008 i = mod (i, base); 0009 for n = length-1:-1:1 0010 base = base / 256; 0011 s = [floor(i / base) s]; 0012 i = mod (i, base); 0013 end; 0014 s=char(s);