TEAP (Toolbox for Emotion Analysis using Physiological Signals) doc
mat2sel.m
Go to the documentation of this file.
1 function HDR = mat2sel(FileName,fnout);
2 % MAT2SEL is useful for converting visual artifact selection
3 % with gBSanalyze into BKR/EPS compliant *.SEL files.
4 %
5 % HDR = mat2sel(infile, [selfile]);
6 % infile input filename (*.BKR or *.MAT are supported)
7 % selfile output file with info artifact selection [OPTIONAL]
8 % if no selfile is provided, the information will be
9 % stored with extension '.SEL' and the same filename and
10 % path.
11 %
12 % The artifact selection is available in HDR.ArtifactSelection and
13 % can be also loaded with
14 % [s,HDR]=sload(filename);
15 % Currently, artifact selection of EPS/BKR-Software and
16 % gBSanalyze is supported.
17 %
18 % see also: SLOAD
19 
20 % $Revision: 1.1 $
21 % $Id: mat2sel.m 2205 2009-10-27 12:18:15Z schloegl $
22 % Copyright (C) 2004 by Alois Schloegl
23 % a.schloegl@ieee.org
24 
25 % This library is free software; you can redistribute it and/or
26 % modify it under the terms of the GNU Library General Public
27 % License as published by the Free Software Foundation; either
28 % Version 2 of the License, or (at your option) any later version.
29 %
30 % This library is distributed in the hope that it will be useful,
31 % but WITHOUT ANY WARRANTY; without even the implied warranty of
32 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
33 % Library General Public License for more details.
34 %
35 % You should have received a copy of the GNU Library General Public
36 % License along with this library; if not, write to the
37 % Free Software Foundation, Inc., 59 Temple Place - Suite 330,
38 % Boston, MA 02111-1307, USA.
39 
40 [s,HDR] = sload(FileName);
41 
42 if isfield(HDR,'ArtifactSelection'),
43  artifact = HDR.ArtifactSelection;
44 
45  save([HDR.FILE.Name, '_artifact'], 'artifact');
46 
47  if nargin<2,
48  fnout = [HDR.FILE.Name, '.sel']
49  fnout = fullfile(HDR.FILE.Path,[HDR.FILE.Name, '.sel']);
50  end
51  if 0, exist(fnout)==2,
52  fprintf(1,'File %s exists! Do you want to overwrite ',fnout);
53  answer = input('[Y/N] ?');
54  else
55  answer = 'Y';
56  end;
57  if any(answer=='jJyYzZ'),
58  fid = fopen(fnout,'w');
59  fprintf(fid, '%i\r\n', artifact);
60  fclose(fid);
61  end;
62 end;
sload
function sload(in FILENAME, in varargin)
mat2sel
function mat2sel(in FileName, in fnout)