Home > vbmeg > external > mne > fiff_write_dau16.m

fiff_write_dau16

PURPOSE ^

SYNOPSIS ^

function fiff_write_dau16(fid, kind, data)

DESCRIPTION ^

 fiff_write_dau16(fid, kind, data)

 Writes a 16-bit integer tag to a fif file

     fid           An open fif file descriptor
     kind          Tag kind
     data          The integers to use as data

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function fiff_write_dau16(fid, kind, data)
0002 %
0003 % fiff_write_dau16(fid, kind, data)
0004 %
0005 % Writes a 16-bit integer tag to a fif file
0006 %
0007 %     fid           An open fif file descriptor
0008 %     kind          Tag kind
0009 %     data          The integers to use as data
0010 %
0011 
0012 %
0013 %   Author : Matti Hamalainen, MGH Martinos Center
0014 %   License : BSD 3-clause
0015 %
0016 %   No part of this program may be photocopied, reproduced,
0017 %   or translated to another program language without the
0018 %   prior written consent of the author.
0019 %
0020 
0021 me = 'MNE:fiff_write_dau16';
0022 
0023 if nargin ~= 3
0024     error(me, 'Incorrect number of arguments');
0025 end
0026 
0027 FIFFT_DAU_PACK16 = 16;
0028 FIFFV_NEXT_SEQ = 0;
0029 nel = numel(data);
0030 datasize = nel * 2;
0031 count = fwrite(fid, int32(kind), 'int32');
0032 if count ~= 1
0033     error(me, 'write failed');
0034 end
0035 count = fwrite(fid, int32(FIFFT_DAU_PACK16), 'int32');
0036 if count ~= 1
0037     error(me, 'write failed');
0038 end
0039 count = fwrite(fid, int32(datasize), 'int32');
0040 if count ~= 1
0041     error(me, 'write failed');
0042 end
0043 count = fwrite(fid, int32(FIFFV_NEXT_SEQ), 'int32');
0044 if count ~= 1
0045     error(me, 'write failed');
0046 end
0047 count = fwrite(fid, int16(data), 'int16');
0048 if count ~= nel
0049     error(me, 'write failed');
0050 end
0051 
0052 return

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