Home > bioelectromagnetism > freesurfer_fwrite3.m

freesurfer_fwrite3

PURPOSE ^

freesurfer_fwrite3 - FreeSurfer function to write a 3 byte integer to a file

SYNOPSIS ^

function freesurfer_fwrite3(fid, val)

DESCRIPTION ^

 freesurfer_fwrite3 - FreeSurfer function to write a 3 byte integer to a file
 
 freesurfer_fwrite3(fid, val)

 see also freesurfer_read3, freesurfer_read_surf, freesurfer_write_surf

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function freesurfer_fwrite3(fid, val)
0002 
0003 % freesurfer_fwrite3 - FreeSurfer function to write a 3 byte integer to a file
0004 %
0005 % freesurfer_fwrite3(fid, val)
0006 %
0007 % see also freesurfer_read3, freesurfer_read_surf, freesurfer_write_surf
0008 
0009 if(nargin ~= 2)
0010   fprintf('USAGE: freesurfer_fwrite3(fid, val)\n');
0011   return;
0012 end
0013 
0014 %fwrite(fid, val, '3*uchar') ;
0015 b1 = bitand(bitshift(val, -16), 255) ;
0016 b2 = bitand(bitshift(val, -8), 255) ;
0017 b3 = bitand(val, 255) ; 
0018 fwrite(fid, b1, 'uchar') ;
0019 fwrite(fid, b2, 'uchar') ;
0020 fwrite(fid, b3, 'uchar') ;
0021 
0022 return

Generated on Mon 15-Aug-2005 15:36:19 by m2html © 2003