Home > eeg > egis > net_utils > rd_fragger_hdr.m

rd_fragger_hdr

PURPOSE ^

[header_array, EventCodes,Samp_Rate, NChan, scale, NSamp, NEvent] = rd_fragger_hdr(fid);

SYNOPSIS ^

function [header_array, EventCodes,Samp_Rate, NChan, scale, NSamp, NEvent] = rd_fragger_hdr(fid);

DESCRIPTION ^

[header_array, EventCodes,Samp_Rate, NChan, scale, NSamp, NEvent] = rd_fragger_hdr(fid);

 reads in header version 2 of NSFragger output files 
 header_array = complete header except event codes
 EventCodes = event codes 
 Samp_Rate = sampling rate
 NChan = #of channels
 scale = constant to use to convert data to microvolts
 NSamp = sampling rate
 NEvent = number of events

 Release 1.0 2/9/97 R.S. 
 
 Note: This code was developed on my own time, for your lab use.  
       Please don't redistribute on your own without asking me.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [header_array, EventCodes,Samp_Rate, NChan, scale, NSamp, NEvent] = rd_fragger_hdr(fid);
0002 %[header_array, EventCodes,Samp_Rate, NChan, scale, NSamp, NEvent] = rd_fragger_hdr(fid);
0003 %
0004 % reads in header version 2 of NSFragger output files
0005 % header_array = complete header except event codes
0006 % EventCodes = event codes
0007 % Samp_Rate = sampling rate
0008 % NChan = #of channels
0009 % scale = constant to use to convert data to microvolts
0010 % NSamp = sampling rate
0011 % NEvent = number of events
0012 %
0013 % Release 1.0 2/9/97 R.S.
0014 %
0015 % Note: This code was developed on my own time, for your lab use.
0016 %       Please don't redistribute on your own without asking me.
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

Generated on Wed 20-Sep-2023 04:00:50 by m2html © 2003