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