TEAP (Toolbox for Emotion Analysis using Physiological Signals) doc
fefopen.m
Go to the documentation of this file.
1 function [HDR]=fefopen(arg1)
2 % FEFOPEN opens and reads FEF file
3 %
4 % HDR=fefopen(HDR)
5 %
6 %
7 % see also: SOPEN
8 %
9 % References:
10 % <A HREF="ftp://sigftp.cs.tut.fi/pub/eeg-data/standards/cenf060.zip ">About CEN/TC251</A>
11 
12 % $Id: fefopen.m 2205 2009-10-27 12:18:15Z schloegl $
13 % Copyright (c) 1998,2004,2008 Alois Schloegl <a.schloegl@ieee.org>
14 % This is part of the BIOSIG-toolbox http://biosig.sf.net/
15 
16 % This library is free software; you can redistribute it and/or
17 % modify it under the terms of the GNU Library General Public
18 % License as published by the Free Software Foundation; either
19 % Version 3 of the License, or (at your option) any later version.
20 
21 if ischar(arg1)
22  HDR.FILE.OPEN = 0;
23  HDR.FileName = arg1;
24  HDR.FILE.FID = fopen(HDR.FileName,'r');
25  HDR.FILE.OPEN = 0;
26 else
27  HDR = arg1;
28 end;
29 
30 
31 TYP_OID16 = 'uint16';
32 
33 N = 0;
34 tag=fread(HDR.FILE.FID,1,TYP_OID16);
35 len=fread(HDR.FILE.FID,1,'uint16');
36 while ~feof(HDR.FILE.FID),
37  value=fread(HDR.FILE.FID,len,'uint8');
38 
39  tmp.TAG = sprintf('%x',tag);
40  tmp.LEN = len;
41  tmp.VAL = value(1:min(len,10))';
42 
43  if tag>0,
44  N = N+1;
45  HDR.tag{N} = tmp;
46  end;
47 
48  tag=fread(HDR.FILE.FID,1,TYP_OID16);
49  len=fread(HDR.FILE.FID,1,'uint16');
50 end;
51 
52 
53 if ~HDR.FILE.OPEN,
54  fclose(HDR.FILE.FID);
55 end;
fefopen
function fefopen(in arg1)