[fid] = fiff_start_file(name) Opens a fif file for writing and writes the compulsory header tags name The name of the file to open. It is recommended that the name ends with .fif
0001 function [fid] = fiff_start_file(name) 0002 % 0003 % [fid] = fiff_start_file(name) 0004 % 0005 % Opens a fif file for writing and writes the compulsory header tags 0006 % 0007 % name The name of the file to open. It is recommended 0008 % that the name ends with .fif 0009 % 0010 % 0011 0012 % 0013 % 0014 % Author : Matti Hamalainen, MGH Martinos Center 0015 % License : BSD 3-clause 0016 % 0017 % Revision 1.3 2006/04/23 15:29:40 msh 0018 % Added MGH to the copyright 0019 % 0020 % Revision 1.2 2006/04/10 23:26:54 msh 0021 % Added fiff reading routines 0022 % 0023 % Revision 1.1 2005/12/05 16:01:04 msh 0024 % Added an initial set of fiff writing routines. 0025 % 0026 % 0027 0028 me='MNE:fiff_start_file'; 0029 if nargin ~= 1 0030 error(me,'File name required as an argument'); 0031 end 0032 0033 [fid,message] = fopen(name,'w+','ieee-be'); 0034 if fid < 0 0035 error(me,message); 0036 end 0037 % 0038 % Write the compulsory items 0039 % 0040 FIFF_FILE_ID=100; 0041 FIFF_DIR_POINTER=101; 0042 FIFF_FREE_LIST=106; 0043 0044 fiff_write_id(fid,FIFF_FILE_ID); 0045 fiff_write_int(fid,FIFF_DIR_POINTER,-1); 0046 fiff_write_int(fid,FIFF_FREE_LIST,-1); 0047 % 0048 % Ready for more 0049 % 0050 return; 0051