urbiInt2Chars

PURPOSE ^

Convert a value to corresponding binary string in length byte

SYNOPSIS ^

function s=urbiInt2Chars(i, length)

DESCRIPTION ^

 Convert a value to corresponding binary string in length byte

  This function is used in converting a sound to a Wav file.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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);

Generated on Tue 20-Dec-2005 19:05:34 by m2html © 2003