Home > vbmeg > external > mne > fiff_write_float.m

fiff_write_float

PURPOSE ^

SYNOPSIS ^

function fiff_write_float(fid,kind,data)

DESCRIPTION ^

 fiff_write_float(fid,kind,data)
 
 Writes a single-precision floating point tag to a fif file

     fid           An open fif file descriptor
     kind          Tag kind
     data          The data

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function fiff_write_float(fid,kind,data)
0002 %
0003 % fiff_write_float(fid,kind,data)
0004 %
0005 % Writes a single-precision floating point tag to a fif file
0006 %
0007 %     fid           An open fif file descriptor
0008 %     kind          Tag kind
0009 %     data          The data
0010 %
0011 
0012 %
0013 %   Author : Matti Hamalainen, MGH Martinos Center
0014 %   License : BSD 3-clause
0015 %
0016 %   Revision 1.3  2006/04/27 22:38:37  msh
0017 %   Splitting an empty list now results in an empty output.
0018 %   Added fiff_write_double and fiff_write_short
0019 %   Write an array of floats, ints, and doubles instead of just one value.
0020 %   Fixed help text of fiff_pick_channels.
0021 %
0022 %   Revision 1.2  2006/04/23 15:29:40  msh
0023 %   Added MGH to the copyright
0024 %
0025 %   Revision 1.1  2006/04/10 23:26:54  msh
0026 %   Added fiff reading routines
0027 %
0028 %
0029 
0030 me='MNE:fiff_write_float';
0031 
0032 if nargin ~= 3
0033         error(me,'Incorrect number of arguments');
0034 end
0035 
0036 FIFFT_FLOAT=4;
0037 FIFFV_NEXT_SEQ=0;
0038 nel=numel(data);
0039 datasize=nel*4;
0040 count = fwrite(fid,int32(kind),'int32');
0041 if count ~= 1
0042     error(me,'write failed');
0043 end
0044 count = fwrite(fid,int32(FIFFT_FLOAT),'int32');
0045 if count ~= 1
0046     error(me,'write failed');
0047 end
0048 count = fwrite(fid,int32(datasize),'int32');
0049 if count ~= 1
0050     error(me,'write failed');
0051 end
0052 count = fwrite(fid,int32(FIFFV_NEXT_SEQ),'int32');
0053 if count ~= 1
0054     error(me,'write failed');
0055 end
0056 count = fwrite(fid,single(data),'single');
0057 if count ~= nel
0058     error(me,'write failed');
0059 end
0060 
0061 return;
0062

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005