-
Notifications
You must be signed in to change notification settings - Fork 11
/
pop_parsesmi.m
79 lines (70 loc) · 2.52 KB
/
pop_parsesmi.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
% pop_parsesmi() - parses text-converted (ASCII) SMI raw data and
% saves it in a Matlab structure. Will import messages and events,
% if detected. Builds table of events from trigger pulses sent during
% the experiment. If the user provides a keyword that marks special
% keyword-containing messages as synchronisation events, these
% messages will be used to build the event table instead.
%
% Usage:
% >> ET = pop_parsesmi
%
% Inputs:
% - no inputs allowed
% Outputs:
% ET - Eyetracker structure. Note: This gets deleted
% immediately, when used via EEGLAB menu. You will only need the
% mat-file location in the following pop_importeyetracker.
%
% An example call of the function might look like this:
% >> ET = pop_parsesmi
%
% See also:
% parsesmi, pop_importeyetracker, pop_parseeyelink,
%
% Author: ur
% Copyright (C) 2009-2021 Olaf Dimigen & Ulrich Reinacher, HU Berlin
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, 51 Franklin Street, Boston, MA 02110-1301, USA
function [et, com] = pop_parsesmi
com = '';
try
% pop up dialogue
[fileToLoad, matToSave, useMessageTrigger, triggerKeyword] = dlg_parser(mfilename);
%% test for identical filenames
if strcmp(fileToLoad,matToSave)
error('%s(): Input and output file names should not be identical.',mfilename)
end
%% call parser
if ~useMessageTrigger
et = parsesmi( fileToLoad, matToSave);
else
et = parsesmi( fileToLoad, matToSave, triggerKeyword);
end
catch err
if (strcmp(err.identifier,'MATLAB:unassignedOutputs'))
et = [];
return
else
rethrow(err);
end
end
%% return string command for history
if ~useMessageTrigger
allArgs = vararg2str({fileToLoad, matToSave});
else
allArgs = vararg2str({fileToLoad, matToSave, triggerKeyword});
end
com = sprintf('ET = %s(%s);','parsesmi',allArgs);
return;