Home > vbmeg > external > mne > fiff_write_double.m

fiff_write_double

PURPOSE ^

SYNOPSIS ^

function fiff_write_double(fid,kind,data)

DESCRIPTION ^

 fiff_write_int(fid,kind,data)
 
 Writes a double-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_double(fid,kind,data)
0002 %
0003 % fiff_write_int(fid,kind,data)
0004 %
0005 % Writes a double-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.2  2006/05/26 07:17:17  msh
0017 %   The me variable was set incorrectly
0018 %
0019 %   Revision 1.1  2006/04/27 22:38:37  msh
0020 %   Splitting an empty list now results in an empty output.
0021 %   Added fiff_write_double and fiff_write_short
0022 %   Write an array of floats, ints, and doubles instead of just one value.
0023 %   Fixed help text of fiff_pick_channels.
0024 %
0025 %
0026 
0027 me='MNE:fiff_write_double';
0028 
0029 if nargin ~= 3
0030         error(me,'Incorrect number of arguments');
0031 end
0032 
0033 FIFFT_DOUBLE=5;
0034 FIFFV_NEXT_SEQ=0;
0035 nel=numel(data);
0036 datasize=nel*8;
0037 count = fwrite(fid,int32(kind),'int32');
0038 if count ~= 1
0039     error(me,'write failed');
0040 end
0041 count = fwrite(fid,int32(FIFFT_DOUBLE),'int32');
0042 if count ~= 1
0043     error(me,'write failed');
0044 end
0045 count = fwrite(fid,int32(datasize),'int32');
0046 if count ~= 1
0047     error(me,'write failed');
0048 end
0049 count = fwrite(fid,int32(FIFFV_NEXT_SEQ),'int32');
0050 if count ~= 1
0051     error(me,'write failed');
0052 end
0053 count = fwrite(fid,double(data),'double');
0054 if count ~= nel
0055     error(me,'write failed');
0056 end
0057 
0058 return;

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