mne_fwrite(fid, val) write a 3 byte integer to a file
0001 function mne_fwrite3(fid, val) 0002 % 0003 % mne_fwrite(fid, val) 0004 % write a 3 byte integer to a file 0005 % 0006 0007 % 0008 % 0009 % Author : Matti Hamalainen, MGH Martinos Center 0010 % License : BSD 3-clause 0011 % 0012 % Revision 1.3 2006/04/23 15:29:40 msh 0013 % Added MGH to the copyright 0014 % 0015 % Revision 1.2 2006/04/10 23:26:54 msh 0016 % Added fiff reading routines 0017 % 0018 % Revision 1.1 2005/11/21 02:15:51 msh 0019 % Added more routines 0020 % 0021 % 0022 0023 b1 = bitand(bitshift(val, -16), 255) ; 0024 b2 = bitand(bitshift(val, -8), 255) ; 0025 b3 = bitand(val, 255) ; 0026 fwrite(fid, b1, 'uchar') ; 0027 fwrite(fid, b2, 'uchar') ; 0028 fwrite(fid, b3, 'uchar') ; 0029 0030