TEAP (Toolbox for Emotion Analysis using Physiological Signals) doc
openxlt.m
Go to the documentation of this file.
1 function [HDR]=openxlt(fn)
2 % OPENXLT is an auxillary function to SOPEN for
3 % opening of XLTEK files
4 %
5 % Use SOPEN instead of OPENXLT
6 %
7 % See also: fopen, SOPEN,
8 %
9 % References:
10 
11 % This program is free software; you can redistribute it and/or
12 % modify it under the terms of the GNU General Public License
13 % as published by the Free Software Foundation; either version 3
14 % of the License, or (at your option) any later version.
15 
16 % $Id: openxlt.m 2205 2009-10-27 12:18:15Z schloegl $
17 % (C) 2004,2008 by Alois Schloegl <a.schloegl@ieee.org>
18 % This is part of the BIOSIG-toolbox http://biosig.sf.net/
19 %
20 % Thanks to Andrey Vankov for his support.
21 
22 
23 fprintf(2,'Warning: OPENXLT is in an experimental state and is most likely not useful to you.\n');
24 fprintf(2,'\t Do not use it unless you are sure know what you do. At least you are warned!\n');
25 
26 if ischar(fn)
27  HDR.FileName = fn;
28  [pfad,file,FileExt] = fileparts(HDR.FileName);
29  HDR.FILE.Name = file;
30  HDR.FILE.Path = pfad;
31  HDR.FILE.Ext = char(FileExt(2:length(FileExt)));
32 end;
33 
34 % read etc file
35 fid = fopen(fullfile(HDR.FILE.Path,[HDR.FILE.Name,'.etc']),'r');
36 if fid<0,
37  fid = fopen(fullfile(HDR.FILE.Path,[HDR.FILE.Name,'.ETC']),'r');
38 end
39 if fid>0,
40  status = fseek(fid,hex2dec(164),'bof');
41  HDR.XLT.timebase = fread(fid,1,'int32');
42  fclose(fid);
43 end;
44 
45 % read ent file
46 fid = fopen(fullfile(HDR.FILE.Path,[HDR.FILE.Name,'.ent']),'r');
47 if fid<0,
48  fid = fopen(fullfile(HDR.FILE.Path,[HDR.FILE.Name,'.ENT']),'r');
49 end
50 if fid>0,
51  while ~feof(fid)
52  tline = fgetl(fid);
53  if strncmp(tline,'Stamp',5),
54  [t,r] = strtok(tline,' ');
55  [t,r] = strtok(r,' ');
56  [HDR.XLT.timebase2,c] = str2double(t);
57  ix = strfind(tline,'patient');
58  else
59 
60  end
61  end;
62  fclose(fid);
63 end;
64 
65 
66 % read erd file
67 fid = fopen(HDR.FileName);
68 if fid>0,
69  HDR.H1 = fread(fid,352,'uchar');
70  HDR.SampleRate = fread(fid,1,'uchar');
71  tmp = fread(fid,2,'int32');
72  HDR.NS = tmp(1);
73  HDR.bits = tmp(2); % ???? ###
74  HDR.XLT.PhysChan = fread(fid,1024,'int32');
75  HDR.XLT.HeadBoxType = fread(fid,4,'int32');
76  HDR.XLT.HeadBoxSN = fread(fid,4,'int32');
77  HDR.XLT.HeadBoxSoftwareVersion = fread(fid,[4,16],'uint8');
78  HDR.XLT.DSP_HW_Version = fread(fid,[16],'uint8');
79  HDR.XLT.DSP_SW_Version = fread(fid,[16],'uint8');
80  HDR.XLT.DiscardBits = fread(fid,4,'int32');
81 
82  HDR.XLT.shorted = fread(fid,1024,'int16');
83  HDR.XLT.FrequencyFactor = fread(fid,1024,'int16');
84 
85  HDR.HeadLen = hex2dec('21D0');
86  status = fseek(fid,HDR.HeadLen,'bof');
87 
88 
89 
90 
91  fclose(fid);
92 
93 end;
94 
openxlt
function openxlt(in fn)
str2double
function str2double(in s, in cdelim, in rdelim, in ddelim)