0001 function [header_array, EventCodes,Samp_Rate, NChan, scale, NSamp, NEvent] = rd_fragger_hdr(fid);
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 if (nargin < 1)
0019 error('you didnt provide an fid');
0020 end;
0021 if fid < 1
0022 error('you didnt provide a valid file');
0023 end;
0024 version = fread(fid,1,'integer*4');
0025 if version ~= 2
0026 error('the jig is up, EGI has updated its software without informing me');
0027 end;
0028
0029 year = fread(fid,1,'integer*2');
0030 month = fread(fid,1,'integer*2');
0031 day = fread(fid,1,'integer*2');
0032 hour = fread(fid,1,'integer*2');
0033 minute = fread(fid,1,'integer*2');
0034 second = fread(fid,1,'integer*2');
0035 millisecond = fread(fid,1,'integer*4');
0036 Samp_Rate = fread(fid,1,'integer*2');
0037 NChan = fread(fid,1,'integer*2');
0038 Gain = fread(fid,1,'integer*2');
0039 Bits = fread(fid,1,'integer*2');
0040 Range = fread(fid,1,'integer*2');
0041 scale = Range/(2^Bits);
0042 NSamp = fread(fid,1,'integer*4');
0043 NEvent = fread(fid,1,'integer*2');
0044 for i = 1:NEvent
0045 EventCodes(i,1:4) = fread(fid,[1,4],'char*1');
0046 end;
0047 header_array = [version year month day hour minute second millisecond Samp_Rate NChan Gain Bits Range NSamp NEvent];
0048
0049
0050
0051
0052
0053