0001 function fiff_write_short(fid, kind, data)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 me = 'MNE:fiff_write_short';
0025
0026 if nargin ~= 3
0027 error(me, 'Incorrect number of arguments');
0028 end
0029
0030 FIFFT_SHORT = 2;
0031 FIFFV_NEXT_SEQ = 0;
0032 nel = numel(data);
0033 datasize = nel * 2;
0034 count = fwrite(fid, int32(kind), 'int32');
0035 if count ~= 1
0036 error(me, 'write failed');
0037 end
0038 count = fwrite(fid, int32(FIFFT_SHORT), 'int32');
0039 if count ~= 1
0040 error(me, 'write failed');
0041 end
0042 count = fwrite(fid, int32(datasize), 'int32');
0043 if count ~= 1
0044 error(me, 'write failed');
0045 end
0046 count = fwrite(fid, int32(FIFFV_NEXT_SEQ), 'int32');
0047 if count ~= 1
0048 error(me, 'write failed');
0049 end
0050 count = fwrite(fid, int16(data), 'int16');
0051 if count ~= nel
0052 error(me, 'write failed');
0053 end
0054
0055 return