-
Notifications
You must be signed in to change notification settings - Fork 11
/
eegplugin_bva_io.m
79 lines (71 loc) · 3.05 KB
/
eegplugin_bva_io.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
% eegplugin_bva_io() - EEGLAB plugin for importing Brainvision
% .vhdr and .ahdr data files.
%
% Usage:
% >> eegplugin_bva_io(fig, trystrs, catchstrs);
%
% Inputs:
% fig - [integer] EEGLAB figure
% trystrs - [struct] "try" strings for menu callbacks.
% catchstrs - [struct] "catch" strings for menu callbacks.
%
% Author: Andreas Widmann for binary import, 2004
% Arnaud Delorme for Matlab import and EEGLAB interface
%
% See also: pop_loadbv()
% Copyright (C) 2004 Andreas Widmann & Arnaud Delorme
%
% 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 2 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, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
% $Id: eegplugin_bva_io.m 53 2010-05-22 21:57:38Z arnodelorme $
function vers = eegplugin_bva_io(fig, trystrs, catchstrs)
vers = 'bva_io1.73';
if nargin < 3
error('eegplugin_bva_io requires 3 arguments');
end;
% add folder to path
% ------------------
if ~exist('eegplugin_bva_io')
p = which('eegplugin_bva_io.m');
p = p(1:findstr(p,'eegplugin_bva_io.m')-1);
addpath( p );
end;
% find import data menu
% ---------------------
menui = findobj(fig, 'tag', 'import data');
menuo = findobj(fig, 'tag', 'export');
% menu callbacks
% --------------
icadefs;
versiontype = 1;
if exist('EEGLAB_VERSION')
if EEGLAB_VERSION(1) == '4'
versiontype = 0;
end;
end;
if versiontype == 0
comcnt1 = [ trystrs.no_check '[EEGTMP LASTCOM] = pop_loadbv;' catchstrs.new_non_empty ];
comcnt2 = [ trystrs.no_check '[EEGTMP LASTCOM] = pop_loadbva;' catchstrs.new_non_empty ];
else
comcnt1 = [ trystrs.no_check '[EEG LASTCOM] = pop_loadbv;' catchstrs.new_non_empty ];
comcnt2 = [ trystrs.no_check '[EEG LASTCOM] = pop_loadbva;' catchstrs.new_non_empty ];
end;
comcnt3 = [ trystrs.no_check 'LASTCOM = pop_writebva(EEG);' catchstrs.add_to_hist ];
comcnt4 = [ trystrs.no_check 'LASTCOM = pop_copybv();' catchstrs.add_to_hist ];
% create menus
% ------------
uimenu( menui, 'label', 'From Brain Vis. Rec. .vhdr or .ahdr file', 'callback', comcnt1, 'separator', 'on' );
uimenu( menui, 'label', 'From Brain Vis. Anal. Matlab file', 'callback', comcnt2 );
uimenu( menuo, 'label', 'Write Brain Vis. exchange format file', 'callback', comcnt3, 'separator', 'on' );
uimenu( menuo, 'label', 'Copy and Rename Brain Vis. exchange files', 'callback', comcnt4 );